c# - AsyncPostBackTimeout not updating data in updatepanel -


i wanted update data inside update panel without postback.

i made following code on aspx:

<asp:scriptmanager id="scriptmanager1" runat="server" asyncpostbacktimeout="30">     </asp:scriptmanager>     <asp:updatepanel id="uppanel" runat="server">         <contenttemplate>             <asp:label id="lblcount" runat="server"></asp:label>         </contenttemplate>     </asp:updatepanel> 

for updating label on every half minute, written following code on pageload:

 protected void page_load(object sender, eventargs e)     {         lblcount.text = datetime.now.toshorttimestring();     } 

but not updating label though given

asyncpostbacktimeout="30" 

in script manager.

is mistaking??

i want update label inside updatepanel without postback on time interval.

edit:

 <asp:updatepanel id="uppanel" runat="server">     <triggers>         <asp:asyncpostbacktrigger controlid="timer1" eventname="tick" />         </triggers>         <contenttemplate>               <asp:label id="lblcount" runat="server"></asp:label>         </contenttemplate>.      </asp:updatepanel> 

to update your page every 30 seconds can use timer:

<head runat="server"> <title></title>  <script runat="server" type="text/c#">     protected void timer1_tick(object sender, eventargs e)     {         lblcount.text = "panel refreshed at: " + datetime.now.tolongtimestring();     } </script> 

<form id="form1" runat="server">     <asp:scriptmanager id="scriptmanager1" runat="server" asyncpostbacktimeout="30">     </asp:scriptmanager>     <asp:timer runat="server" id="timer1" interval="30000" ontick="timer1_tick"></asp:timer>     <asp:updatepanel id="uppanel" runat="server">          <triggers>             <asp:asyncpostbacktrigger controlid="timer1" eventname="tick" />         </triggers>         <contenttemplate>             <asp:label id="lblcount" runat="server" text="page not refreshed yet."></asp:label>         </contenttemplate>     </asp:updatepanel> </form> 

as @nipun ambastha suggested add asyncpostbacktrigger trigger.

without asyncpostbacktrigger, timer has placed inside updatepanel:

protected void timer1_tick(object sender, eventargs e)     {         label1.text = "panel refreshed at: " + datetime.now.tolongtimestring();     }  <form id="form2" runat="server">     <asp:scriptmanager runat="server" id="scriptmanager2">     </asp:scriptmanager>     <asp:updatepanel runat="server" id="updatepanel1">         <contenttemplate>             <asp:timer runat="server" id="timer2" interval="30000" ontick="timer1_tick"></asp:timer>             <asp:label runat="server" text="page not refreshed yet." id="label1">             </asp:label>         </contenttemplate>     </asp:updatepanel>     <asp:label runat="server" text="label" id="label3"></asp:label> </form> 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -