ADRotator:
Adrotator control is one of the rich contorls, Rich Controls are server sided controls that can be used to create complex HTML elements. rich controls provide the developer with complex functionality without having to manually wrote the code to provide that functionality.
Internet advertising is one of the major means of earning revenu for a web site. while viewing the site, the advertisements keep changing.Having a control to change the advertisements continously can reduce a lot of coding. In asp.net the ad rotator control can perform the functionality required for changing the advetisements.
Download Source code
the advertisents to be displayed need to be taken fron a life. Let us consider an XML file for the same. An ad element has to be added to describe each advertisement.
Here in my example shows an XML file that contains Ad element to describe the advertisements.
adds.xml
<?xml version="1.0" encoding="utf-8" ?> <Advertisements> <Ad> <ImageUrl>Images/1.gif</ImageUrl> <NavigateUrl>http://www.deliciousdotnet.blogspot.com/</NavigateUrl> <AlternateText>Alt Text</AlternateText> <Keyword>Computers</Keyword> </Ad> <Ad> <ImageUrl>Images/2.gif</ImageUrl> <NavigateUrl>http://www.deliciousdotnet.blogspot.com/</NavigateUrl> <AlternateText>Alt Text</AlternateText> <Keyword>Computers</Keyword> </Ad> <Ad> <ImageUrl>Images/3.gif</ImageUrl> <NavigateUrl>http://www.deliciousdotnet.blogspot.com/</NavigateUrl> <AlternateText>Alt Text</AlternateText> <Keyword>Computers</Keyword> </Ad> </Advertisements>
Now after creating the advertisment file. the ad rotator control that will rotate these advertisements on the web site munst be created. The following code will create an ad rotator with the id "AdRotator1" that oicks the advertisements from the adds.xml
<body> <form id="form1" runat="server"> <div> <asp:AdRotator ID="AdRotator1" AdvertisementFile="adds.xml" BorderWidth="1" runat="server" Height="300px" Width="300px" /> </div> </form> </body>
Download Source code









