Sunday, August 26, 2012

ADRotator

AdRotator
This control is used to display a sequence of rotating ad images. Whenever you refresh the page it will show new image. It uses an XML file to store the ad information. The XML file must begins and end with an .Inside the tag there may be several tags which defines each ad


Element
The predefined elements inside the tag are listed below.
<ImageUrl> Optional. The path to the image file.
<NavigateUrl>Optional.The URL to link to if the user clicks the ad
<Alternate Text>Optional. An alternate text for the image
<Keyword>Optional. A category for the ad
<Impressions>Optional.The display rates in percent of the hits.

Property

Some properties of this control:
AdvertisementFile: Specifies the path to the XML file that contains ad information.
AlternateTextField: Specifies a data field to be used instead of the Alt text for an ad
ImageUrlField: Specifies a data field to be used instead of the ImageURL attribute for an ad
KeywordFilter: Specifies a filter to limit ads after categories.
NavigateUrlField: Specifies a data field to be used of the NavigateUrl attribute for an ad

The steps to display advertisement by using AdRotator control.

1. Select images what you want to select but each image should have fixed dimension (size).Here we have taken three images google.jpg (200, 75), Microsoft.jpg (200, 75) and oracle.jpg (200, 75).
2. Start Visual Studio.Net
3. Create a new ASP.NET Web Application

4.      Change its name to Advertisement
5.In Solution Explorer, right click on project name and select Add New Item
6.'Add New Item Window' will come. Select XML File template and change its name to Ad.xml
7.Add new folder named as Images and place the images that we want to use for advertisement. Open the   Ad.xml and places the code shown in figure.                          

8.Open the design view of default.aspx and drag AdRotator control from the Toolbox. Reposition the control to Top Center and resize it to size as the images what we have taken(200,75)
9.Click AdRotator1 and then press F4 key to view its properties. 10.Set the AdvertisementFile property to Ad.xml
11.Save Default.aspx and build and run the project.
After refreshing the page we  will get other ad.

No comments:

Copyright © Codingnodes,2014.All Rights Reserved.