Tutorial :How to refresh parent window's grid view only when model popup is closed in asp.net?


I am working with asp.net and model popup. in popup window when i edit the changes it must get reflect on paren windows grid view. so any one tell me how to refresh paren window's grid view only without reloading entire page after closing popup.

Thank in advance.


Usually its better to have a method in the parent window itself.

In the parent page have a function like this:

function closeAndRefresh()  {      //code for closing the popup and       //refresing window  }  

In the popup page have a javascript function like this:

function closeMe()  {      window.opener.closeAndRefresh();  }  

PS: you'll need the reference to the popup window from the parent. Hence when you do a window.open() take care to store the reference to the resultant popup window...


In that parent page you need a close method similar to this

// Called by popup window  function closeNotesWindow(isReload)  {      var mgr = $find("<%=radWindowManagerNotes.ClientID%>");      var wnd = mgr.getWindowByName("radWindowPopupNotes");      wnd.close();        if (isReload)      {          __doPostBack("<%=this.buttonManualPostback.UniqueID%>", "ProcessNotes");      }  }  

The popup page should call the method on the parent page.

Here, i'm closing it on the code behind after a submit:

Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClosePopup", "window.parent.closeNotesWindow(true);", true);  


use script manager and update panel and use ajax control toolkit popup model extender. make the reference of ajax control tool kit

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>    <cc1:ModalPopupExtender ID="SamplePopup" runat="server" TargetControlID="imgButtonSample"              PopupControlID="SamplePanel" BackgroundCssClass="modalBackground" DropShadow="true" />          <asp:Panel ID="SamplePanel" runat="server" CssClass="modalPopup12" Style="display: none;"              Width="880px" Height="450PX">              <asp:Panel ID="Panel3" runat="server" Width="880px" Height="455PX" CssClass="modalPopup2">                  <iframe src="SamplePage.aspx" id="addIFrame" width="820" height="430"></iframe>                  <br />                  <span class="popuplinktext">                      <asp:LinkButton ID="lnkClose" runat="server" Text="Close" ForeColor="WHITE" CssClass="popuplinktext"                          CausesValidation="false" OnClick="lnkClose_Click" /></span>              </asp:Panel>          </asp:Panel>  

and in the lnkClose_Click event bind the grid again. so dtata in the grid view get refresh. try it out.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »