ajax for partial refresh of the page
-
I am using ajax scriptmanager to update system time on the webpage. the corresponding code was placed in ContentTemplate. The text out side the contentTemplate also refreshing instead of partial refresh of the page. pls help me. code: aspx ------------ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Ajax.aspx.cs" Inherits="WebApplication1.Ajax" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label2" runat="server" Text="My System time:"></asp:Label> <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> </asp:UpdatePanel> <asp:Timer ID="Timer1" runat="server" Interval="500" ontick="Timer1_Tick" /> </div> </form> </body> </html> //server side code using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; namespace WebApplication1 { public partial class Ajax : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) Label1.Text = System.DateTime.Now.ToString(); } protected void Button1_Click(object sender, EventArgs e) { Label1.Text = System.DateTime.Now.ToString(); } protected void Timer1_Tick(object sender, EventArgs e) { Label1.Text = System.DateTime.Now.ToString(); } } } Pls help to resolve this problem
-
I am using ajax scriptmanager to update system time on the webpage. the corresponding code was placed in ContentTemplate. The text out side the contentTemplate also refreshing instead of partial refresh of the page. pls help me. code: aspx ------------ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Ajax.aspx.cs" Inherits="WebApplication1.Ajax" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label2" runat="server" Text="My System time:"></asp:Label> <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> </asp:UpdatePanel> <asp:Timer ID="Timer1" runat="server" Interval="500" ontick="Timer1_Tick" /> </div> </form> </body> </html> //server side code using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; namespace WebApplication1 { public partial class Ajax : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) Label1.Text = System.DateTime.Now.ToString(); } protected void Button1_Click(object sender, EventArgs e) { Label1.Text = System.DateTime.Now.ToString(); } protected void Timer1_Tick(object sender, EventArgs e) { Label1.Text = System.DateTime.Now.ToString(); } } } Pls help to resolve this problem