source code
-------------------------
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="20000" ontick="Timer1_Tick">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
-----------------------------------code beind-----------------------
protected void Page_Load(object sender, EventArgs e)
{
if (ScriptManager1.IsInAsyncPostBack==true)
{
Label1.Text = "page is processing as ASynchrouns....";
}
else
{
Label1.Text = "page is processing as Synchronus";
}
}
why page_load code is executed
2 times for first request.
and next(every timer tick interval) onwords if(ScriptManager1.IsInAsyncPostBack==true) is executed succefully.
but Label1.text shows Synchrous only.......... my remaining code is
protected void Timer1_Tick(object sender, EventArgs e)
{
if (ScriptManager1.IsInAsyncPostBack)
{
Label2.Text = DateTime.Now.ToString();
}
else
{
Label2.Text = "this is synchrous postback";
}
}
Regards,
Kasi babu