我有一個WebForm有兩個更新面板:當我點擊其中一個按鈕時,如何防止所有更新面板重新加載?
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release">
</asp:ScriptManager>
<p>
<asp:UpdatePanel ID="upl1" runat="server">
<ContentTemplate>
<asp:Button runat="server" ID="btn1" Text="Button1" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="upl2" runat="server">
<ContentTemplate>
<asp:Button runat="server" id="btn2" Text="Button2" />
</ContentTemplate>
</asp:UpdatePanel>
</p>
如果我點擊btn1
,那麼upl2
負荷事件被觸發,以及upl1
。
我預計只有upl1
被加載,因爲這是包含按鈕的更新面板。
爲什麼不會發生這種情況,我該如何做到這一點?
我認爲你需要使用觸發器來正確地隔離了正確的更新面板 - 看看這個MSDN教程HTTP: //www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-updatepanel-triggers – bUKaneer 2013-02-22 13:25:53