Close popup window after inserting data and refreshing datagrid with new data
<p>I am using asp.net. I have a main page and one popup window. When I click on the button, the popup window will appear. The popup window contains two text fields and two buttons. One is a submit button () for submitting data and the other is a simple input type button for closing the popup window.</p>

<p>When I click on the cancel button, it closes the popup window. But when I fill out the information in the text box and click on submit, it it will insert the data in the server, but the popup window does not close. I can't see the page properly. The data grid refreshes properly but I cannot perform actions on the page. To do this I have to refresh the page manually.</p>

<p>Please tell me how to close the popup window in asp.net after inserting data into the database.</p>

<p>Here is the code to show and hide the popup window:</p>

<pre><code>&lt;script language="javascript" type="text/javascript" src="../JS/jquery.min.js"&gt;&lt;/script&gt;
&lt;script language="javascript" type="text/javascript" src="../JS/modalpopup.js"&gt;&lt;/script&gt;
&lt;style&gt;
  *html #dvPopup {
    top: expression(eval(document.documentElement.scrollTop)) !important;
  }
&lt;/style&gt;
&lt;table style="background-color: transparent" cellspacing="0" cellpadding="0" width="100%"&gt;
  &lt;tr&gt;
    &lt;td class="heder" valign="middle" height="30" style="padding-left: 10px" colspan="2"&gt;
      &lt;img height="13" hspace="5" src="../images/arrow.gif" width="13" align="absMiddle"&gt;
      &amp;nbsp;&lt;strong&gt;Destination Management&lt;/strong&gt;&amp;nbsp;&lt;br /&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Destination Name :
      &lt;asp:TextBox ID="txtDestinationName" runat="server"&gt;&lt;/asp:TextBox&gt;
      &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
        ErrorMessage="*" ControlToValidate="txtDestinationName"&gt;
      &lt;/asp:RequiredFieldValidator&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;asp:Button ID="btnAdd" runat="server" CssClass="BUTTON" Text="Add"
        Width="70px" OnClick="btnAdd_Click" &gt;
      &lt;/asp:Button&gt;&amp;nbsp;
      &lt;input type="button" id="Button1" value="Close"
        onclick="HideModalPopup('dvPopup'); return false;" /&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>Thanks in advance.</p>
