Thursday, June 25, 2009

Update Panel example



This is Good Exaple for Update panel for more info
see this site : http://www.aspcode.net/How-Ajax-for-ASPNET-updatepanels-work.aspx
<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>


Default.aspx.cs

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();
}