-->

Saturday, July 18, 2015

How to Bind Adrotator control in asp.net

How to Bind Adrotator control in asp.net

Introduction
The Adrotator control displays a sequence of images, known as advertisements, on a Web page. The sequence in which the images appear can be predefined or random in nature. These advertisements, which all Internet users are familiar with, are image files in GIF, JPEG, or other format that the user can click to navigate to the advertiser's website.

Public Properties of the Adrotator Class
 AdvertisementFile : Obtains or sets the path to an XML document that contain advertisement information.



Design a xml file for advertisements name as "advertisements.xml" 
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
  <Ad>
    <ImageUrl>security.JPG</ImageUrl>

    <Width>
    200px
  </Width>
    <Height>
      200px
    </Height>
  </Ad>
<Ad>
    <ImageUrl>images.JPG</ImageUrl>
<Width>
    100px
  </Width>
<Height>
      200px
    </Height>
  </Ad>
</Advertisements>
Drag and drop adrotator control onto the design window from toolbox


<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>  
        <asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/advertisements.xml" />
        </div>
    </form>
</body>
</html>
Output
How to bind adrotator control in asp.net

How to bind Adrotator control in asp.net

Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved