Latest web development tutorials

ASP.NET AdRotator Control

Web Server Controls Web server control

Definition and Usage

AdRotator control to display a sequence of images.

The control uses XML file to store ad information. XML files use <Advertisements> begins and ends. In <Advertisements> tags inside, there should be a number of definitions of each ad's <Ad> tags.

<Ad> tags predefined elements are listed below:

元素 描述
<ImageUrl> 可选。图像文件的路径。
<NavigateUrl> 可选。用户点击该 ad 时所链接的 URL。
<AlternateText> 可选。图像的可选文本。
<Keyword> 可选。ad 的类别。
<Impressions> 可选。显示概率。


Attributes

属性 描述 .NET
AdvertisementFile 包含 ad 信息的 XML 文件的路径。 1.0
AlternateTextField 代替广告的 Alt 文本而使用的数据字段。 2.0
ImageUrlField 代替广告的 ImageURL 属性而使用的数据字段。 2.0
KeywordFilter 根据类别对广告进行过滤。 1.0
NavigateUrlField 代替广告的 NavigateUrl 属性而使用的数据字段。 2.0
runat 规定该控件是服务器控件。必须设置为 "server"。 1.0
Target 规定在何处打开 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 full description, visit the Web Control Standard Attributes .

Control Standard Properties

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

For a full description, go to Control Standard Attributes .


Examples

Try - Example

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


Web Server Controls Web server control