Just Do Study - IGNOU Assignments Site: HOW TO CREATE ADROTATOR CONTROL IN ASP.NET

Thursday 1 August 2013

HOW TO CREATE ADROTATOR CONTROL IN ASP.NET



The AdRotator control is used to display a sequence of ad images.

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.



The AdRotator control allows you to specify the advertisement file and the type of window that the link should follow in AdvertisementFile and Target property respectively.


This control uses an XML file to store the ad information. 

The XML file must begin and end with an <Advertisements> tag. Inside the <Advertisements> tag there may be several <Ad> tags which defines each ad.


The predefined elements inside the <Ad> tag are listed below:


ElementDescription
<ImageUrl>Optional. The path to the image file
<NavigateUrl>Optional. The URL to link to if the user clicks the ad
<AlternateText>Optional. An alternate text for the image
<Keyword>Optional. A category for the ad
<Impressions>Optional. The display rates in percent of the hits


Properties

PropertyDescription.NET
AdvertisementFileSpecifies the path to the XML file that contains ad information1.0
AlternateTextFieldSpecifies a data field to be used instead of the Alt text for an ad2.0
ImageUrlFieldSpecifies a data field to be used instead of the ImageURL attribute for an ad2.0
KeywordFilterSpecifies a filter to limit ads after categories1.0
NavigateUrlFieldSpecifies a data field to be used instead of the NavigateUrl attribute for an ad2.0
runatSpecifies that the control is a server control. Must be set to "server"1.0
TargetSpecifies where to open the URL1.0


STEPS TO USE OF ADROTATOR

1.
In Design Mode, Double click on 'AdRotator' control to place AdRotator control wherever you want to put.

2. After that add some images in 'Solution Explorer' to put images in AdRotator.

3. Now, Go to Website->Add New Item->XML File->Add.

4.
In XML File, Write below code:

<Advertisements>
  <Ad>
    <ImageUrl>image1.jpg</ImageUrl>
    <NavigateUrl>http://www.dipanshugarg.asia</NavigateUrl>
    <AlternateText> Dipanshu Garg </AlternateText>
    <Impressions>20</Impressions>
    <Keyword>img1</Keyword>
  </Ad>

  <Ad>
    <ImageUrl>image2.jpg</ImageUrl>
      <NavigateUrl>http://www.hackerreturns.in</NavigateUrl>
      <AlternateText>Learn Ethical Hacking Online</AlternateText>
      <Impressions>20</Impressions>
      <Keyword>img2</Keyword>
  </Ad>

  <Ad>
    <ImageUrl>image3.jpg</ImageUrl>
    <NavigateUrl>http://www.loosetech.blogspot.com</NavigateUrl>
    <AlternateText>C Programming Blog Online</AlternateText>
    <Impressions>20</Impressions>
    <Keyword>img3</Keyword>
  </Ad>

  <Ad>
    <ImageUrl>image4.jpg</ImageUrl>
    <NavigateUrl>http://www.facebook.com/HackerReturns.in</NavigateUrl>
    <AlternateText>Like Us on facebook</AlternateText>
    <Impressions>20</Impressions>
    <Keyword>img4</Keyword>
  </Ad>
</Advertisements>

(You Can Change Bold Contents According To Your Need)

5. Select AdRotator control and go to its Properties.

6. Now, Select 'AdvertisementFile' property to add XML file.



7. Now, Run the program. and its done. . . 

No comments:

Post a Comment