2015-12-04 47 views
0

點擊按鈕打開一個彈出窗口。在子窗口中,我做了一些更改,當我保存時,彈出窗口需要關閉,並且部分父頁面可以像單個更新面板一樣刷新。在vb.net的關閉彈出窗口中刷新部分父頁面

我不想完整的父頁面刷新。

+0

爲什麼你不能[使用的UpdatePanel] (http://stackoverflow.com/questions/3490457/update-an-updatepanel-manually-using-javascript-or-jquery)? –

+0

在父頁面3中有更新面板。我只想更新一個 –

+0

你看過我發佈的鏈接了嗎? –

回答

1

您必須觸發從彈出窗口刷新目標更新面板的事件。一種做法是使用window.opener元素。

下面是一個彈出窗口中代碼的簡單示例,您可以爲自己的項目進行調整。請注意,您需要將'btnTriggersUpdate'更改爲給予任何Button觸發更新面板刷新的ClientID。

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

在我的例子,這裏是在父更新面板:

<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> 

家長btnTriggerUpdate_Click證明它更新:

Protected Sub btnTriggersUpdate_Click(sender As Object, e As EventArgs) Handles btnTriggersUpdate.Click 
    lblUpdatePanelLabel.Text = "Updated" 
End Sub 
相關問題