O'Reilly logo

Programming ASP.NET 3.5, 4th Edition by Jesse Liberty, Dan Hurwitz, Dan Maharry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The AdRotator Control

The AdRotator control gets its name because it is most often used to display advertisements on web pages. It displays an image randomly selected from a list stored in either a separate XML file or a data-bound data source. In either case, the list contains image attributes, including the path to the image and a URL to link to when the image is clicked. The image changes every time the page is loaded.

In addition to the properties inherited from WebControl, the AdRotator control has the properties listed in Table 5-17, and an event you can handle called AdCreated. This occurs once per round trip to the server after creation of the control, but before the page is rendered.

Table 5-17. Properties of the AdRotator control

Name

Type

Description

AdvertisementFile

String

The path to an XML file that contains the list of advertisements and their attributes. We describe this file in detail shortly.

AlternateTextField

String

The element name from the AdvertisementFile or data field from which the alternative text is stored. Default is AlternateText.

DataMember

String

The name of the specific list of data the control will bind to if the control is not using an XML file for ads.

DataSource

Object

An object from which the control can retrieve data.

DataSourceID

String

The ID of the control from which the AdRotator can retrieve data.

ImageUrlField

String

The element name from the advertisement file or data field from which the URL for the image is stored. Default is ImageUrl.

KeywordFilter

String ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required