0

On click of button a popup window open. In the child window I made some changes and when I save, popup need to be closed and partial parent page refreshed like a single updatepanel.

I don’t want complete parent page refresh.

Rohit Surve
  • 140
  • 7

1 Answers1

1

You have to trigger the event that refreshes the target update panel from the popup. One way of doing this is using the window.opener element.

Here is a simple example of code in a popup that you can adapt for your project. Note you'll need to change 'btnTriggersUpdate' to the ClientID that is given to whatever Button triggers the Update Panel refresh.

<asp:Button runat="server" ID="btnRefreshParentUpdatePanel" OnClientClick="window.opener.document.getElementById('btnTriggersUpdate').click();" Text="Refresh Parent Update Panel" />

In my example, here is the Update Panel in the parent:

<asp:UpdatePanel ID="upnTarget" runat="server">
    <ContentTemplate>
        <asp:Label id="lblUpdatePanelLabel" runat="server" Text="Not Updated"></asp:Label>
        <asp:Button ID="btnTriggersUpdate" runat="server" Text="Refreshes Update Panel" />
    </ContentTemplate>
</asp:UpdatePanel>  

Parent's btnTriggerUpdate_Click to prove it updates:

Protected Sub btnTriggersUpdate_Click(sender As Object, e As EventArgs) Handles btnTriggersUpdate.Click
    lblUpdatePanelLabel.Text = "Updated"
End Sub 
NoAlias
  • 9,218
  • 2
  • 27
  • 46