Page view counter

How Do I: Use the ASP.NET AJAX Timer Control?

The AJAX Timer control enables a portion of an ASP.NET web page to be dynamically updated at a regular interval, rather than needing the user to perform an action such as clicking on a button.

Presented by Joe Stagner

Duration: 6 minutes, 21 seconds

Date: 13 February 2007

Watch the video   |   Download the video   |   Get VB code  or  C# code

Video downloads: WMV | Zune | iPod | PSP | MPEG-4 | 3GP

Audio downloads: AAC | WMA | MPEG-4 | MPEG-3 | MPEG-2

Comments : 4

Leave a Comment

m_coomer146 : On March 15, 2008 9:33 AM said:

You can also use the time to redirect after a submission. If a user joins your site they are usually directed to a confirmation page.  On the confirmation page you can set the timer to redirect the user back to your home page or to the login page.

<html dir="ltr" xmlns="www.w3.org/.../xhtml">

<script runat="server">

Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs)

Response.Redirect("~/Default.aspx")

End Sub

</script>

<body>

<form id="form1" runat="server">

<h1>Submission successful!</h1>

<p>Thank you for your submission</p>

<p>If you are not redirected in 5 seconds, click <asp:HyperLink runat="server" ID="lnkredirect" NavigateUrl="~/Default.aspx" Text="here"></asp:HyperLink>

</p>

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<asp:Timer ID="Timer1" runat="server" EnableViewState="false" Interval="5000" OnTick="Timer1_Tick">

</asp:Timer>

</form>

</body>

</html>

netnorvin : On June 21, 2008 3:25 AM said:

Hi Joe,

      First of it was g8 demo & i luved it.But i need to know one thing.Suppose I am trying to connect to a External  website or URL.How will i able to catch/handle the exception

within my application if the WebSite/ref URL is Down.Most of the time i get a Parse error.

Thank you !!!        

cv_vikram : On August 06, 2008 1:54 PM said:

Very good tutorial...thanks

Karina Northen : On September 04, 2008 8:31 AM said:

I can’t understand why in  AJAXEnabledWeb Site  not working this code?

 Dim PictureNumber As Integer

   Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

       Select Case PictureNumber

           Case 1

               Image.ImageUrl = "~/images/karina_1.jpg"

           Case 2

               Image.ImageUrl = "~/images/karina_2.jpg"

           Case 3

               Image.ImageUrl = "~/images/karina_3.jpg"

           Case 4

               Image.ImageUrl = "~/images/karina_4.jpg"

           Case 5

               Image.ImageUrl = "~/images/karina_5.jpg"

           Case 6

               Image.ImageUrl = "~/images/karina_6.jpg"

       End Select

       PictureNumber += 1

       If PictureNumber > 6 Then

           PictureNumber = 1

       End If

   End Sub

Haw get timer not to stop here after 6 ticks?

   Protected Sub Timer2_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer2.Tick

       Dim n As Integer = New Random().Next(1, 6)

       Image6.ImageUrl = "~/images/karina_" + n.ToString + ".jpg"

       Image6.Visible = True

   End Sub

Please help …

Karina.

e-mail: karina.northen@talktalk.net

Leave a Comment

You must be logged in to leave a comment. Click here to log in.

Microsoft Communities