ASP.Net 2.0 AdRotator won't rotate

Posted on 2007-10-19
Last Modified: 2012-08-13
Hello, I have an adrotator componet ( 2.0) connected to a sqldatasource that collects the ad information.  I was under the assumption (obviously wrong) that the adrotator would magically rotate through the recordset.

Is there another setting or something that motivates the adrotator to move to the next ad.  If not, do I write a sub?

Here's my adrotator:

  <asp:AdRotator ID="AdRotator1" runat="server" DataSourceID="SqlDataSourceAdRotator" Width="100px"
          OnAdCreated="CreateNewAd" />
Question by:vstack
    LVL 28

    Expert Comment

    I would look at the DB structure and make sure that is matched below:

        * An int primary key, which can be called anything you like
        * an nvarchar field called ImageURL that has a relative or absolute URL pointing to the image to be displayed
        * an nvarchar field called NavigateURL that has a relative or absolute URL that the image is hyperlinked to. If you leave the contents of this field blank, theres no hyperlink from the image.
        * an nvarchar field called AlternateText containing a string that will be inserted into the <IMG> tags ALT attribute (and will, therefore, depending on the viewing browsers capabilities or preferences, be displayed as a tooltip, or instead of the image or be read aloud to the user etc). By the way, is it just me, or should this be called "AlternativeText"?

    pulled from

    Author Comment

    Maybe I misunderstand what this component does.  I was expecting it to cycle through the ads while the page sits (like an animated gif - ) but does it simply display a different ad everytimme the page is visited?
    I know you can weight how often each ad is displayed.

    I have the following table

    CREATE TABLE [dbo].[tblAdRotatorSponsors](
          [AdID] [int] IDENTITY(1,1) NOT NULL,
          [AlternateText] [varchar](100) COLLATE Latin1_General_CI_AS NULL,
          [ImageUrl] [varchar](100) COLLATE Latin1_General_CI_AS NULL,
          [NavigateUrl] [varchar](200) COLLATE Latin1_General_CI_AS NULL,
          [AdID] ASC
    ) ON [PRIMARY]

    LVL 4

    Accepted Solution

    The behaviour you see is as expected. Every time the page is requested the server selects a new item and renders.

    If you want to extend this functionality you could wrap the adRotator in an Update panel and then use a Timer control to call AdRotator1.DataBind()

    You will then get the functionality you expect

    Author Comment

    Thanks, I use Visual Studio Express.  Is there a timer component and update panel available?

    I see this as a possible solution but what about the performance hit every time the db is called?

    By the way, I will issue you the points for this.  Thanks for setting me straight.
    LVL 4

    Expert Comment

    I couldn't say if one is available for VS express. However I assume that if you install the MS AJAX librarys you may find you get these controls.

    Yes there is a performace hit, this is a very simplistic solution. If I was to expect very high volumes of traffic I would code the control from the ground up using core ajax technologys instead of the UpdatePanel control.

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now