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();
        }

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,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.