AdRotator control in ASP.Net

Adrotator control is available in ASP.Net to make the task of rotating the advertisement images in a web form quickly and easily. It also enables you to display different types of images whenever you refresh the page.

Adrotator control takes the information about the images that are to be displayed from an XML file which also have many other elements in it that are used by this control.

Adrotator control is available in ASP.Net to make the task of rotating the advertisement images in a web form quickly and easily. It also enables you to display different types of images whenever you refresh the page.

Adrotator control takes the information about the images that are to be displayed from an XML file which also have many other elements in it that are used by this control.

First let us have a look at a sample advertisement file that is used by the adrotator control in ASP.Net.

Let us assume that the advertisement XML file is named as advt.xml. This file might look like,
<Advertisements>
<Ad>
  <ImageUrl>yahoo.jpg</ImageUrl>
  <NavigateUrl>http://www.yahoo.com</NavigateUrl>
  <AlternateText>Yahoo Image</AlternateText>
  <Impressions>50</Impressions>
  <Keyword>yahoo</Keyword>
</Ad>
<Ad>
  <ImageUrl>google.jpg</ImageUrl>
  <Navigateurl>http://www.google.com</Navigateurl>
  <AlternateText>Google Image</AlternateText>
  <Impressions>75</Impressions>
  <Keyword>Google</Keyword>
</Ad>
</Advertisements>
The XML file that is used for advertisements would have the root element as the <Advertisements> element.

This may have many <Ad> child elements. The elements <ImageUrl>, <NavigateUrl>, <AlternateText>, <Impressions> and <Keyword> are found in the <Ad> element. These elements identify the properties of the image that is displayed using the adrotator control.

The <ImageUrl> element specifies the path to the image that is displayed using the AdRotator control.

Once a user clicks the image that is displayed the user is taken to the URL specified in the <NavigateUrl> element.

The <AlternateText> element holds the text that is displayed when the image is not loaded. The text in this element is also used as a ToolTip in some of the browsers.

The element <Impressions> has a number as a value. This number indicates how often the image is displayed with respect to other images. The more the value of the number in this element, the more is the frequency of the image that is displayed. The sum of all the impressions in the advertisement file should not exceed 2,047,999,999. Otherwise the AdRotator will throw an runtime exception.

The element <Keyword> is used to give the category of the advertisement.

Thus the AdRotator control is an easy way to display and rotate advertisements and also to give preference to some advertisements by using the <Impressions> element of the advertisement XML file.

Comments

Popular posts from this blog

Auto Sequence Number in Grid Control with Paging

Polymorphism in C#

Print Function By JavaScript

Variable Value in Top Statement

How to Update Dependent Excel Cells Automatically

Auto Refresh .aspx page - ASP.NET

Paged Data Source - Custom Paging