0

Morning Guys,I have an issue with timer a wrote a code which i will write below and whenever it is running it loads like refreshes the browser each time and it shows the loading symbol as it displays each new seconds i mean from second 1 to 2 to 3 to 4....
it does a refresh in between not making my web page smoooth actually have tried on 3 diff browsers all showin gsame thing pls will love some one to help immediately.
this is my code

<asp:Panel ID="bt" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:Timer ID="Timer1" runat="server" OnTick="tick" Interval="50">
        </asp:Timer>

  <asp:Label ID="time" runat="server"></asp:Label>

  </asp:Panel>

//for code behind

 protected void tick(object sender, EventArgs e)
        {
            

            time.Text =   System.DateTime.Now.ToString("hh:mm:ss");
      }


        protected void Page_Load(object sender, EventArgs e)
        {

           tie.Text = DateTime.Now.ToString();
        }
2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by hericles
0

Hi,
It appears you are missing the UpdatePanel and ContentTemplate required to show which parts of the page are updated by the AJAX request.

Change your code to this and it should help:

<asp:Panel ID="bt" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server" id="updatePanel1">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" OnTick="tick" Interval="50">
</asp:Timer>
 
<asp:Label ID="time" runat="server"></asp:Label>
</contentTemplate>
</asp:Panel>

Let me know if that works,

Edited by hericles: emoticons in the code snippet

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.