top of page

AdRotator in ASP.NET with C#

  • Mahesh Bhat
  • Jul 9, 2017
  • 1 min read

The AdRotator control randomly selects banner graphics from a list, which is specified in an external XML schedule file. This external XML schedule file is called the advertisement file.

First will create one asp form for the adrotator :

1) Visual C# -> Web -> Web Form -> Name -> Add

2) Drag the adrotator and necessary tools from the tool box .

3) Link the XML file to the Adrotator.

How to create an XML file in ASP .NET ?

AdvertisementFile : - Encloses the advertisement file.

ImageUrl : - The path of image that will be displayed.

NavigateUrl : - The link that will be followed when the user clicks the ad.

AlternateText : -The text that will be displayed instead of the picture if it cannot be displayed.

Height : -Height of the image to be displayed.

Width : -Width of the image to be displayed.

Before starting with XML create two folder

one is for images or advertisement

another for html file or ad html .

1) Visual c# -> Data -> XML File -> File name -> Add.

2) Check all these propertise

3) Write the code in XML

The source code

<?xml version="1.0" encoding="utf-8" ?> <Advertisements> <Ad> <ImageUrl>pics/fedora.png</ImageUrl> <NavigateUrl>url/fedora.html</NavigateUrl> <AlternateText>Click to visit </AlternateText> </Ad> <Ad> <ImageUrl>pics/redhat.png</ImageUrl> <NavigateUrl>url/redhat.html</NavigateUrl> <AlternateText>Click to visit </AlternateText> </Ad> <Ad> <ImageUrl>pics/debian.png</ImageUrl> <NavigateUrl>url/debian.html</NavigateUrl> <AlternateText>Click to visit </AlternateText> </Ad> </Advertisements>

Comments


Recent Posts

© 2023 by Kathy Schulders. Proudly created with Wix.com 

  • Grey Twitter Icon
bottom of page