AdRotator Control

This control is called an AdRotator because it is most often used to display advertisements on web pages. It displays an image randomly selected from a list stored either in 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 and events listed in Table 5-10.

Table 5-10. Properties and events of the AdRotator control

Name

Type

Get

Set

Description

AdvertisementFile

String

The path to an XML file that contains the list of advertisements and their attributes. This file is described in detail below.

AlternateTextField

String

Element name from the Advertisement file or data field from which the alternate text is stored. Default is AlternateText.

DataMember

String

The name of the specific list of data the control will bind to.

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

Element name from the Advertisement file or data field from which the URL for the image is stored. Default is ImageUrl.

KeywordFilter

String

Filters ads displayed to include only those with the specified ...

Get Programming ASP.NET, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.