tick event not work in asp ajax 2.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • preetityagi
    New Member
    • Nov 2009
    • 2

    tick event not work in asp ajax 2.0

    I am unable to change the ads in adrotator placed inside the update panel. for some reason timer1_click event is not firing.

    Code:
    f<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="adrot.aspx.cs" Inherits="_Default" %>
     
    <%@ Register
        Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI" TagPrefix="asp" %>
     
     
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
     <asp:ScriptManager ID="ScriptManager2" runat="server" />
    <asp:Timer ID="Timer1"  Interval="2000" runat="server"  OnTick="Timer1_Tick1" />
     
    <asp:UpdatePanel ID="up1" runat="server">
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer1"  EventName="Tick" />
    </Triggers>
    <ContentTemplate>
    <asp:Label ID="Label1" runat="server" Text="UpdatePanel1 not refreshed yet."></asp:Label>
    <asp:AdRotator
    id="AdRotator1"
    AdvertisementFile="~/App_Data/Ad1.xml"
    KeywordFilter="small"
    Runat="server" />
    </ContentTemplate>
    </asp:UpdatePanel>
     
       
        </div>
        </form>
    </body>
    </html>
    --------------------------------------------------------------------------------------------------------------
    Code:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
     
    public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
     
        }
       
        protected void Timer1_Tick1(object sender, EventArgs e)
        {
            up1.Update();
        }
    }
    ----------------------------------------------------------------------------------------------------------
    Code:
    <?xmlversion ="1.0"encoding="utf-8" ?>
    <Advertisements>
      <Ad>
        <ImageUrl>~/Images/ad1_1.jpg</ImageUrl>
        <NavigateUrl>http://www.dotnetcurry.com</NavigateUrl>
        <AlternateText>DotNetCurry Home Page</AlternateText>
        <Impressions>40</Impressions>
        <Keyword>small</Keyword>
      </Ad>
      <Ad>
        <ImageUrl>~/Images/ad1_2.jpg</ImageUrl>
        <NavigateUrl>http://www.sqlservercurry.com</NavigateUrl>
        <AlternateText>SQL Server Curry Home Page</AlternateText>
        <Impressions>20</Impressions>
        <Keyword>small</Keyword>
      </Ad>
      <Ad>
        <ImageUrl>~/Images/ad1_3.jpg</ImageUrl>
        <Width>300</Width>
        <Height>50</Height>
        <NavigateUrl>http://www.dotnetcurry.com/writeforus.aspx</NavigateUrl>
        <AlternateText>dotnetcurry.com Write For Us</AlternateText>
        <Impressions>40</Impressions>
        <Keyword>small</Keyword>
      </Ad>
    </Advertisements>
    Last edited by tlhintoq; Dec 28 '09, 04:52 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Have you placed a break point on the Timer1_Tick1 method to see if it's ever reached?

      Have you tried specifying that Timer1 is Enabled (in your aspx code)?

      -Frinny

      Comment

      Working...