using System; using System.Collections.Generic; using System.Linq; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI.HtmlControls; using System.Timers; namespace WebApplication1 { public partial class WebForm3 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { addimages2(); } } private void addimages2() { Random rand = new Random(); int i = rand.Next(1, 4); Image1.ImageUrl = "~/pics/" + i.ToString() + ".jpg"; } protected void Timer1_Tick(object sender, EventArgs e) { addimages2(); } } }
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Image ID="Image1" runat="server" Width="200px" Height="121px" /> <asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick"> </asp:Timer> </ContentTemplate> </asp:UpdatePanel>
WebApplication1.WebForm3
<%@ Page ... %>
.aspx
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)