Posts Tagged ‘update panel’
Nested Update Panel
Set the UpdateMode to Conditional to create a nested update panel , so that the parent update panel will not get refreshed when the child is being refreshed.
<pre lang=”vb.net”>
<form id=”form1″ runat=”server”>
<asp:ScriptManager ID=”ScriptManager1″ runat=”server”>
</asp:ScriptManager>
<div>
<table width=”80%” border=”3″>
<tr>
<td>
Label outside all the Update Panels
<asp:Label ID=”Label3″ runat=”Server” Font-Bold=”true”></asp:Label>
<br />
<br />
<asp:Button ID=”Button3″ runat=”Server” Text=”Refresh” />
<br />
<br />
</td>
</tr>
<tr>
<td>
<table width=”65%” border=”2″>
<tr>
<td>
<asp:UpdatePanel ID=”UpdatePanel1″ runat=”server” UpdateMode=”Conditional”>
<ContentTemplate>
Label within the Parent Update Panel
<asp:Label ID=”Label1″ runat=”server” Font-Bold=”true”></asp:Label>
<br />
<br />
<asp:Button ID=”Button1″ runat=”server” Text=”Refresh” />
<table width=”40%” border=”1″>
<tr>
<td>
<asp:UpdatePanel ID=”UpdatePanel2″ runat=”server” UpdateMode=”Conditional”>
<ContentTemplate>
<br />
<br />
Label within the Child Update Panel
<asp:Label ID=”Label2″ runat=”server” Font-Bold=”True”></asp:Label>
<br />
<br />
<asp:Button ID=”Button2″ runat=”server” Text=”Refresh” />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
Code behind
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = System.DateTime.Now.ToString();
Label2.Text = System.DateTime.Now.ToString();
Label3.Text = System.DateTime.Now.ToString();
}
</pre>
<a href=”http://geekswithblogs.net/ranganh/archive/2007/05/16/112525.aspx”>Source</a>