Onlineatoz.net | Toolbox Standard Control AdRotator

Toolbox Standard Control AdRotator

AdRotator Web Server Control

The AdRotator Web server control can be used for the Advertisement(Ads) purposes in your ASP.NET Web pages. The control displays a graphic image that you provide — a .gif file or similar image. When users click the ad, they are redirected to a target URL that you have specified. The control automatically reads advertisement information, such as the graphic file name and the target URL, from a list of ads that you provide using a data source, which is usually an XML file or database table.

Display Ads via XML file

The following attributes can be included in the XML files:

  • ImageUrl -The URL of the image to display.
  • NavigateUrl-The URL of the page to go to when the AdRotator control is clicked.
  • AlternateText -The text to display if the image is unavailable.
  • Keyword -The category of the ad, which can be used to filter for specific ads.
  • Impressions -A numeric value (a weighting number) that indicates the likelihood of how often the ad is displayed.it cannot exceed 2,048,000,000 - 1.
  • Height -The height of the ad in pixels
  • Width -The width of the ad in pixels
Sample XML file
 
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements xmlns="http://schemas.microsoft.com/AspNet/
AdRotator-Schedule-File">
<Ad>
<ImageUrl>~/images/Contoso_ad.gif</ImageUrl>
<NavigateUrl>http://www.contoso-ltd.com</NavigateUrl>
<AlternateText>Ad for Contoso, Ltd. Web site</AlternateText>
<Impressions>100</Impressions>
</Ad>
<Ad>
<ImageUrl>~/images/Aspnet_ad.gif</ImageUrl>
<NavigateUrl>http://www.asp.net</NavigateUrl>
<AlternateText>Ad for ASP.NET Web site</AlternateText>
<Impressions>50</Impressions>
</Ad>
</Advertisements>
 
Use XML file with AdRotator

 

  • Place an AdRotator control on the ASP.NET Web page at the location where you want the ads to display.
  • Set the AdRotator control's AdvertisementFile property to the path of the XML file that you created in the previous procedure.

 

Display Ads via Database

The AdRotator control reads advertisement information from a data source, which contains one or more ad records. You can store ad information in a database table

  • create a table with the essentail fields. All columns except ID are optional. it includes fields such as ID,ImageUrl,NavigateUrl,AlternateText,Keyword,Impressions,Width,Height
  • Insert new records into the table with ad information.
Use Database with AdRotator

 

  • Place a data source control, such as a SqlDataSource or AccessDataSource control, onto the page.
  • Configure the data source control with a connection string and query to select all of the records from the database table you created earlier.
  • Set the AdRotator control's DataSourceID property to the ID of the data source control

 

Related Links

Posted by: Admin
Posted on: 9/13/2011 at 12:23 PM
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed