Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi all,

I am working with masterpages + updatepanel + timer control in asp.net.
On timer control i am setting my label to visible=false which is inside updatepanel after some interval of time.
When applying with updatepanel + timer control then it works properly refreshing only updatepanel. But when working with masterpages instead of update panel complete page gets refreshed.

Source Code
<asp:updatepanel id="UpdatePanel1" runat="server" updatemode="Conditional" childrenastriggers="true" xmlns:asp="#unknown">
                                               <contenttemplate>
                                                   <asp:label id="lbl_msg" runat="server" forecolor="Red" font-bold="False" font-size="Small"></asp:label>
                                                   <asp:timer id="Timer1" runat="server" interval="5000">
                                                   </asp:timer>
                                               </contenttemplate>
                                               <triggers>
                                                   <asp:asyncpostbacktrigger controlid="Timer1" eventname="Tick" />
                                               </triggers>
                                           </asp:updatepanel>

and timer1_tick code is as follows :
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
       Dim time1 As TimeSpan = New TimeSpan
       time1 = Convert.ToDateTime(Session("time")) - DateTime.Now
       If time1.Seconds <= 0 Then
           lbl_msg.Text = ""
       Else
       End If
   End Sub

My requirement is to only refresh only update panel instead of complete page.

Any help is greatly appreciated
Thanx
Posted

1 solution

Why on earth do you need all of this to run a timer ? Why not do it all on the client?
 
Share this answer
 
Comments
Sushma_Patel 2-Aug-10 3:28am    
Can you provide me any good link on how to do it ?
koool.kabeer 2-Aug-10 3:56am    
yes you can provide a good link .......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900