This control is used to display collection of advertisements simultaneously, this control automatically rotating advertisements when web page is refreshing, AdRotator control the Microsoft designed based on extensible markup language (XML). So we use XML data to this AdRotator Control.
Right click on your solution file and select add New Item, there you select XML file then press OK.
In xml file add the below code.
<Advertisements>
<Ad>
<ImageUrl>~/Images/CoolTuts.JPG</ImageUrl>
<NavigateUrl>http://www.cooltuts.com/</NavigateUrl>
</Ad>
<Ad>
<ImageUrl>~/Images/PleaseWait.JPG</ImageUrl>
<NavigateUrl>http://www.desibindaas.com/</NavigateUrl>
</Ad>
<Ad>
<ImageUrl>~/Images/Submit.JPG</ImageUrl>
<NavigateUrl>http://www.bing.com/</NavigateUrl>
</Ad>
</Advertisements>
The elements we use mainly in this XML file is explained below.
ImageUrl: Location of your Image.
NavigationUrl: Where to navigate when the image is clicked.
AlternateText: This is useful when there is now image in your file.
Impressions: this indicates the likelihood of the image getting selected for display.
Keyword: this sets the category of the image in order to allow for the filtering of ads.
After adding a XML file to your project with adding above code in it. Its time to add AdRotator to your page with having a property AdvertisementFile=”XML File” as shown below.
<asp:AdRotator ID="AdRotator1" runat="server"
AdvertisementFile="~/XMLFile.xml" />
Hence you see by refreshing the web page. The Ads are changing according to your impression element timings.
Thanks
Emmaneale Mendu
Web Developer.
ASP Standard Controls
- ASP Label Control
- ASP TextBox Control
- ASP Button Control
- ASP Link Button Control
- ASP ImageButton Control
- ASP HyperLink Control
- ASP DropDownList Control
- ASP ListBox Control
- ASP CheckBox Control
- ASP CheckBoxList Control
- ASP RadioButton Control
- ASP RadioButtonList Control
- ASP Image Control
- ASP ImageMap Control
- ASP Calendar Control
- ASP Table Control
- ASP BulletedList Control
- ASP Hidden Control
- ASP Literal Control
- ASP AdRotator Control
- ASP Panel Control
- ASP PlaceHolder Control
- ASP FileUpload Control
- ASP UserControl
- ASP Custom Control
Random Tips and Tricks
Thursday, October 7, 2010
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment