Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi i m new to .net i have created a web appliaction in that i want to display Current Time, i achived it using Timer & Sript manager but problem is that my timer Post Back to server for each interval so my page gets load for every Timer Interval Plz Help me Out friends i dont want page to get reload for every interval
any suggestion Pls Post

timer1.interval=600
<br />
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick, ScriptManager1.Disposed<br />
                 LabelTime.text= DateTime.now.toLongTimeString()<br />
end sub<br />
Posted
Updated 30-Jan-12 3:25am
v2

Hi,

Look at this[^] example.

All you need is an UpdatePanel control with AsyncPostBackTrigger...
 
Share this answer
 
Comments
dinidusoft123 30-Jan-12 4:21am    
Yes. it is the solution...
XML
<div>
        <asp:ScriptManager runat="server" ID="sc1">
        </asp:ScriptManager>
    </div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <br />
            <asp:Label ID="Label1" runat="server"></asp:Label>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
    </asp:UpdatePanel>
    <br />
    <br />
    <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
    </asp:Timer>
    <div>

set time interval=1000
 
Share this answer
 
v2
Comments
Anuja Pawar Indore 30-Jan-12 9:06am    
Removed extra pre tag

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