Simple Timer Control Example

Sandhyab
Posted by Sandhyab under ASP.NET AJAX category on | Points: 40 | Views : 1402
aspx:
<asp:ScriptManager ID="scriptManager" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="updatePanel" runat="server">
<ContentTemplate>
<asp:Image ID="image" ImageUrl="Images/1.jpg" runat="server" />
<asp:Timer ID="timerControl" runat="server" OnTick="timerControl_Tick" Interval="2000">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>


Code Behind:

protected void timerControl_Tick(object sender, EventArgs e)
{
//string path = Server.MapPath("~/");
string imageURL = image.ImageUrl;

if (image.ImageUrl == "Images/1.jpg")
image.ImageUrl = "Images/4.jpg";
else if (image.ImageUrl == "Images/4.jpg")
image.ImageUrl = "Images/1.jpg";
}

Comments or Responses

Login to post response