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>

, ,

  1. No comments yet.
(will not be published)
Submit Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Subscribe to comments feed
  1. No trackbacks yet.

SetPageWidth