In a page contains two UpdatePanels
, How can I know which UpdatePanel
causes the partial PostBack
?
I mean in the Page_Load
event handler.
This is my code:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"
onprerender="UpdatePanel1_PreRender">
<ContentTemplate>
<A:u1 ID="u1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"
onprerender="UpdatePanel2_PreRender">
<ContentTemplate>
<A:u2 ID="u2" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
I tried this code, but it isn't worked alost!
protected void Page_Load(object sender, EventArgs e)
{
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
{
if (UpdatePanel1.IsInPartialRendering)
{
// never enter to here
}
if (UpdatePanel2.IsInPartialRendering)
{
// neither here
}
}
}
Any help!
See Question&Answers more detail:os