<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="L_PaperSet.aspx.cs" Inherits="Lib_Web.WebForm2" %> <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> <style type="text/css"> .style7 { width: 100%; } .style8 { width: 228px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <table class="style7"> <tr> <td class="style8"> </td> <td> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick"> </asp:Timer> <asp:Image ID="Image1" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </td> </tr> <tr> <td class="style8"> </td> <td> </td> </tr> </table> </asp:Content>
Collapse | Copy Code using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Lib_Web { public partial class WebForm2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { NewMethod(); } } protected void Timer1_Tick(object sender, EventArgs e) { NewMethod(); } private void NewMethod() { Random rand = new Random(); int i = rand.Next(1, 4); Image1.ImageUrl = "~/L_pics/" + i.ToString() + ".jpg"; } } }
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'ASP.l_paperset_aspx' does not contain a definition for 'Timer1_Tick' and no extension method 'Timer1_Tick' accepting a first argument of type 'ASP.l_paperset_aspx' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 23:
Line 24:
Line 25: <asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick">
Line 26:
Line 27: <asp:Image ID="Image1" runat="server" />