In this blog, I’m explaining about AdRotator in ASP.Net


The AdRotator control presents ad images that, when clicked, navigate to a new web location. Each time the page is loaded into the browser, an ad is randomly selected from a predefined list.

Attributes                                                   Description

ImageURL                                           The URL of the image to display.

NavigateURL                                      The web location to navigate to when the image is clicked.

                                                                   If NavigateUrl is not set, the image is not clickable.

AlternateText                                     The text to display if the image is unavailable.

Keyword                                               The category of the ad, which can be used to filter for                                                                                   specific ads.

Impressions                                         This display rates in percent of the hits.

NOTE: All attributes are optional.

1.  To create ad list as an XML file.

2.Create an ad element inside the Advertisements element for each ad that you want to include in the ad list and then save the file.

<?xml version="1.0" encoding="utf-8" ?>
    <width>40px </width>
    <AlternateText>DotNetCurry Home Page</AlternateText>
   <width>40px </width>
    <AlternateText>DotNetCurry Home Page</AlternateText>
    <AlternateText>DotNetCurry Home Page</AlternateText>

2.    Create a AdRotatorFIle.aspx

(Rotate Ads without Refreshing the page using AdRotator and ASP.NET Ajax)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdRotator.aspx.cs" Inherits="AdRotatorProject.AdRotator" %>
<!DOCTYPE html>
<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
         <div style="width: 100%;">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:Timer ID="Timer1" Interval="2000" runat="server" />
            <asp:UpdatePanel ID="up1" runat="server">
                    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                        runat="server" Target="_top" Width="500px" />

AdRotator in ASP.NETAdRotator in ASP.NET



Leave Comment