I am currently working with asp.net and have encountered an issue with a popup window. On my main page, I have a button that, when clicked, triggers the appearance of a popup window. This popup window contains two text fields and two buttons - one for submitting data and the other for closing the window.
When I click the cancel button, the popup window closes as expected. However, if I enter information into the text fields and click submit, the data is successfully inserted into the server but the popup window remains open. This prevents me from properly interacting with the page and I have to manually refresh the page to proceed.
I am seeking advice on how to automatically close the popup window in asp.net after data has been successfully inserted into the database.
Below is the code snippet used to display and hide the popup window:
<script language="javascript" type="text/javascript" src="../JS/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="../JS/modalpopup.js"></script>
<style>
*html #dvPopup {
top: expression(eval(document.documentElement.scrollTop)) !important;
}
</style>
<table style="background-color: transparent" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td class="heder" valign="middle" height="30" style="padding-left: 10px" colspan="2">
<img height="13" hspace="5" src="../images/arrow.gif" width="13" align="absMiddle">
<strong>Destination Management</strong> <br />
</td>
</tr>
<tr>
<td>Destination Name :
<asp:TextBox ID="txtDestinationName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="*" ControlToValidate="txtDestinationName">
</asp:RequiredFieldValidator>
</td>
<td>
<asp:Button ID="btnAdd" runat="server" CssClass="BUTTON" Text="Add"
Width="70px" OnClick="btnAdd_Click" >
</asp:Button>
<input type="button" id="Button1" value="Close"
onclick="HideModalPopup('dvPopup'); return false;" />
</td>
</tr>
</table>
Any advice or suggestions would be greatly appreciated.