Tuesday, January 8, 2013

Working with AdRotator in ASP.NET

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" ?>
    <AlternateText>IT ZONE 1</AlternateText>
    <AlternateText>IT ZONE 2</AlternateText>

Below is our .aspx code.

<asp:AdRotator ID="AdRotator1" runat="server" Width="468px" 
AdvertisementFile="~/AdsXMLFile.xml" />

When you refresh the page images will be displayed dynamically.

No comments:
Write comments
Recommended Posts × +