AdRotator control is very useful when you want to display ad units in your website. You can provide the image information to the AdRotator control using a XML file or the database. AdRotator will display different images in the list when the user Refresh the webpage.
AdRotator Control Properties
1. AdvertisementFile: The path of the XML file in which you store the information of images.
2. AlternateTextField: A data field to use instead of the Alt text for an advertisement.
3. ImageUrlField: The name of the image url field in which image path is store.
4. NavigateUrlField: The name of the navigate url field in which navigate url is store.
5. Target: The target property specify frame that display the content of the AdRotator. It has four types _blank, _parent, _self, _top.
Below is our XML file.
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>~/Ads/1.jpg</ImageUrl>
<NavigateUrl>http://itzonesl.blogspot.com/</NavigateUrl>
<AlternateText>IT ZONE 1</AlternateText>
<Keyword>Site1</Keyword>
</Ad>
<Ad>
<ImageUrl>~/Ads/2.JPG</ImageUrl>
<NavigateUrl>http://itzonesl.blogspot.com/</NavigateUrl>
<AlternateText>IT ZONE 2</AlternateText>
<Keyword>Site2</Keyword>
</Ad>
</Advertisements>
Below is our .aspx code.
<asp:AdRotator ID="AdRotator1" runat="server" Width="468px"
Height="60px"
AdvertisementFile="~/AdsXMLFile.xml" />
When you refresh the page images will be displayed dynamically.
No comments:
Write comments