ADROTATOR CONTROL IN ASP.NET

ADROTATOR CONTROL IN ASP.NET


ADROTATOR CONTROL IN ASP.NET

AdRotator is one of ASP.NET's rich web server controls. AdRotator control is used to display the sequence of advertisement images according to the priority of the image. The Adrotator control displays the sequence of images specified in the external XML file. In an XML file, we use images to display some other attributes, such as image impressions, NavigateUrl, ImageUrl, AlternateText, etc.


Each time an Adrotator control image will be changed while refreshing the web page.


AdRotator control example in ASP.Net


  • Step 1 - Open Visual Studio -> Create a new empty web application.
  • Step 2 - Create a new web page to display AdRotator control.
  • Step 3 - Drag and drop AdRotator Control from the toolbox to the web page.
  • Step 4 - Right-click on Solution Explorer -> Add New Item -> Add new XML file to the project to write advertisement detail.
  • Step 5 - Assign XML file for AdvertisementFile Property of AdRotator control.


Now, let us consider ad rotator control in ASP.NET by example


Adrotator Control in ASP.Net C #


Create a web application in asp.net and take an ad rotator control on the following web forms: -


ADROTATOR CONTROL IN ASP.NET


Now, add a new XML file from Add New Item.


ADROTATOR CONTROL IN ASP.NET

Select the XML file, assign any name to the XML file, and click the Add button to add a new XML file to the website.


ADROTATOR CONTROL IN ASP.NET


The XML file contains advertisement information.



Properties

Description

ImageUrl

It describes the path of the image that will be displayed in the rotator control.

NavigateUrl

Describe the navigation webpage link when the user clicks on the ad image.

AlternateText

The text will be displayed when the image is not displayed

Impressions

Describe the image's display rate or image's priority

Keyword

This is a category of advertising (Ad).


Advertisement for Adrotator Control (Advertisement) XML file


Write the code in the XML file below for the advertisement


<?xml version="1.0" encoding="utf-8" ?>

<Advertisements>

 <Ad>

 <ImageUrl>img/1.png</ImageUrl>

 <NavigateUrl>https://meeraacademy.com</NavigateUrl>

 <AlternateText>Meera Academy</AlternateText>

 <Impressions>50</Impressions>

 <Keyword>Meera</Keyword>

 </Ad>


 <Ad>

 <ImageUrl>img/2.png</ImageUrl>

 <NavigateUrl>http://meera.com</NavigateUrl>

 <AlternateText>Meerta Aademy</AlternateText>

 <Impressions>100</Impressions>

 <Keyword>Academy</Keyword>

 </Ad>

 <Ad>

 <ImageUrl>img/3.png</ImageUrl>

 <NavigateUrl>https://meeraacademy.com</NavigateUrl>

 <AlternateText>Meerta Aademy</AlternateText>

 <Impressions>50</Impressions>

 <Keyword>Academy</Keyword>

 </Ad>

</Advertisements>{codeBox}


Now, assign the XML file to the ad rotator control in the AdvertisementFile property of the rotator control.


ADROTATOR CONTROL IN ASP.NET


The output of the rotator control instance is in c #. In the Adrotator control example above, we provide three images in the Advertisement XML file. When we refresh the webpage, we can see every time in the image below that the image of the advertisement will change.

AKASH TIMES

I AM AN ENGINEER BY PROFESSION BUT BLOGGER IS MY OLD DAYS DREAM TO CREATE MY OWN SITE FOR THOSE WHO ARE CURIOUS ABOUT MY BIRTHPLACE THEN I AM COMING FROM (INDIA). THE CURRENT CITY LIVES IN NAVI MUMBAI, INDIA

Post a Comment

IF YOU HAVE ANY PROBLEM PLEASE FELL FREE TO CONTACT US BY - AKASH TIMES

PREVIOUS POST NEXT POST