Search | Contact | Link To Us  

      ASP.NET       

ASP.NET
Dev Environment
Web Forms
Web Controls
ADO .NET
Web User Controls
Deployment
XML Web Services
ASP.NET Feedback Form
Resources
Discussions
VB .NET
About



Advertisement


     HomeASP.NET> Web ControlsAdRotator 

AdRotator 

On a new Web Form drag a AdRotator control from the toolbox. For this AdRotator control to work we need an Advertisement file (XML file) and some sample images. Add a new XML file to the project selecting from
Project->Add New Item->XML File from the main menu. Name this XML file as Ads.xml. The file Ads.xml looks like the code below:

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>
one.gif
</ImageUrl>
<NavigateUrl>
http://www.startvbdotnet.com
</NavigateUrl>
<AlternateText>
A beginners site for Visual Basic .NET
<Impressions>
25
</Impressions>
<Keyword>
Visual Basic
</Keyword>
</Ad&g
t <Ad>
<ImageUrl>
two.gif
</ImageUrl>
<NavigateUrl>
http://www.msdn.microsoft.com/vbasic
</NavigateUrl>
<AlternateText>
Visual Basic page on Microsoft
</AlternateText>
<Impressions>
20
</Impressions>
<Keyword>
Programming
</Keyword>
</Ad>
<Ad>
<ImageUrl>
three.gif
</ImageUrl>
<NavigateUrl>
http://www.msdn.microsoft.com/net
</NavigateUrl>
<AlternateText>
.NET page on Microsoft
</AlternateText>
<Impressions>
15
</Impressions>
<Keyword>
.NET Information
</Keyword>
</Ad>
</Advertisements>

Once you are finished with the XML file select the AdvertisementFile property in the properties window and assign the above mentioned XML file to this property and click OK. Select the Target property and select a value of your choice from the list (_blank is advisable). Also, have three sample gif images (one.giif, two.gif, three.gif) in the same project folder. Run the application and you will find rotating ads being displayed on your Web page each time you hit the refresh button in your browser.

Live Code Demo



Visual Basic page on Microsoft


  Privacy Policy | Terms of Use | Site Map | Contact

  © 2004-2010 Startvbdotnet.com. All rights reserved.