ASP.NET AdRotatorControl


Web Server ControlsWeb Server Controls

Definition and Usage

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

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

The predefined elements in the <Ad> tag are listed below:

Element Description
<ImageUrl> Optional. The path of the image file.
<NavigateUrl> Optional. The URL linked when the user clicks the ad.
<AlternateText> Optional. The alternate text for the image.
<Keyword> Optional. The category of the ad.
<Impressions> Optional. The display probability.


Properties

Property Description .NET
AdvertisementFile The path of the XML file containing ad information. 1.0
AlternateTextField The data field used instead of the ad's Alt text. 2.0
ImageUrlField The data field used instead of the ad's ImageURL property. 2.0
KeywordFilter Filters the ads by category. 1.0
NavigateUrlField The data field used instead of the ad's NavigateUrl property. 2.0
runat Specifies that the control is a server control. Must be set to "server". 1.0
Target Specifies where to open the URL. 1.0

Web Control Standard Properties

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

For a complete description, please visitWeb Control Standard Properties。

Control Standard Properties

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

For a complete description, please visitControl Standard Properties。


Examples

Try it Yourself - Examples

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.


Web Server ControlsWeb Server Controls Other Extensions