ASP.NET AdRotator Control

Definition and Usage

The AdRotator control is used to display a sequence of images.

This control uses an XML file to store ad information. The XML file starts and ends with <Advertisements>. Within the <Advertisements> tag, there should be several <Ad> tags defining each ad.

Predefined elements in the <Ad> tag are listed below:

Property Description
<ImageUrl> Optional. Path to the image file.
<NavigateUrl> Optional. URL linked when the user clicks on the ad.
<AlternateText> Optional. Optional text for the image.
<Keyword> Optional. Category of the ad.
<Impressions> Optional. Display probability.

Property

Property Description .NET
AdvertisementFile Path to the XML file containing ad information. 1.0
AlternateTextField Data field used instead of the Alt text of the advertisement. 2.0
ImageUrlField Data field used instead of the ImageURL attribute of the advertisement. 2.0
KeywordFilter Filter advertisements based on categories. 1.0
NavigateUrlField Data field to use instead of the NavigateUrl attribute for the advertisement. 2.0
runat Specifies that this control is a server control. It must be set to "server". 1.0
Target Where to open the URL. 1.0

Web Control Standard Attributes

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth 
CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled 
SkinID, Style, TabIndex, ToolTip, Width

For a complete description, please visit Web Control Standard Attributes.

Control Standard Attributes

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls 
EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site 
TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a complete description, please visitControl Standard Attributes.

Example

AdRotator
In this example, we declare an AdRotator control in the .aspx file. Then we create an event handler for the AdCreated event in the .aspx file to override the value of the NavigateUrl element in the XML file.