Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


ASP.Net 2.0 AdRotator won't rotate

Posted on 2007-10-19
Medium Priority
Last Modified: 2012-08-13
Hello, I have an adrotator componet (asp.net 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
  • 3
  • 2
LVL 28

Expert Comment

ID: 20107849
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 http://blogs.msdn.com/acoat/archive/2005/11/07/AdRotator-Dynamic-Image-Generation.aspx

Author Comment

ID: 20108008
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


Accepted Solution

S31B1 earned 2000 total points
ID: 20108033
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 20108062
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.

Expert Comment

ID: 20108095
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

ID: 20108107

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline

578 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