|
AdRotator
The AdRotator is a special control in ASP.NET that is used to display flashing banner
ads. The control is capable of displaying ads randomly or sequentially as set
by the user. Each time the page is refreshed or reloaded a new ad can be displayed
to the user. Also, we can assign priorities in such a way that certain ads are displayed
frequently than others. The class hierarchy for this control is as follows:
Object
Control
WebControl
AdRotator
Notable properties of the AdRotator control are as follows:
AdvertisementFile
KeywordFilter
Target
AdvertisementFile
The AdvertisementFile property specifies the path to an Advertisement File. The Advertisement
file is a
well-formed XML document that contains information for the image that needs to be
displayed and the page to which the user should be redirected when he clicks the ad.
The syntax for the Advertisement file is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>
URL of the image to be displayed
</ImageUrl>
<NavigateUrl>
URL of the page to which the user should be taken
</NavigateUrl>
<AlternateText>
Text to be displyed as tooltip
</AlternateText>
<Keyword>
Keyword used to filter
</Keyword>
<Impressions>
Weight of the ad
</Impressions>
</Ad>
</Advertisements>
|
The different elements of the Advertisement File:
ImageUrl: Specifies the image URL that presents the image
for the advertisement
NavigateUrl: Specifies the URL of the page to which the
user should be taken to when he clicks on the image
AlternateText: An optional parameter that specifies the
text when the user moves his mouse pointer over the image
Keyword: Optional parameter that specifies the keyword (category)
like books, programming, etc
Impressions: Optional parameter that provides a number that
indicates the weight of the ad in the order of rotation with respect to other ads
in the file
KeywordFilter
The KeywordFilter property specifies a keyword to filter for specific types of
advertisements in the XML advertisement file. Each advertisement in the XML advertisement
file can be assigned a category keyword. The KeywordFilter property filters the advertisements
for the specified keyword. Only advertisements containing the keyword will be selected
for the AdRotator control and it is not possible to specify more than one keyword
in the KeywordFilter property, nor it is possible to declare multiple keywords in
the advertisement file.
Target
The Target property specifies the name of the browser window or frame that displays
the contents of the Web page linked to when the AdRotator control is clicked. This
property can also take the following HTML
frame-related keywords.
_blank: displays the linked content in a new window without
frames
_parent: displays the linked content in the parent window
of the window that contains the link
_self: displays the linked content in the same window
_top: displays the linked content in the topmost window
Next>> AdRotator Sample
|