Pages

Monday, 24 February 2014

AdRotator control in asp.net

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Rotatorcontrol.aspx.cs" Inherits="Rotatorcontrol" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    
   <div>
   <asp:ScriptManager ID="ScriptManager1" 
                      runat="server">
   </asp:ScriptManager>
    
   <asp:Timer ID="Timer1" runat="server" 
              Interval="1500">
   </asp:Timer>
    
   <asp:UpdatePanel ID="UpdatePanel1" 
                    runat="server">
   <Triggers>
   <asp:AsyncPostBackTrigger ControlID="Timer1" 
                             EventName="Tick" />
   </Triggers>
    
   <ContentTemplate>
   <asp:AdRotator ID="AdRotator1" runat="server" 
                  AdvertisementFile="~/RotatorXML.xml"
                  KeywordFilter="Asp.Net">
   </asp:AdRotator>
   </ContentTemplate>
   </asp:UpdatePanel>
   </div>
  
    </form>
</body>
</html>



XML File:::

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
  <Ad>
    <ImageUrl>~/images (1).jpg</ImageUrl>
    <NavigateUrl>http://www.google.com</NavigateUrl>
    <AlternateText>AdRotator Control sample ads</AlternateText>
    <Impressions>20</Impressions>
    <Keyword>Asp.Net</Keyword>

  </Ad>
  <Ad>
    <ImageUrl>~/images.jpg</ImageUrl>
    <NavigateUrl>http://csharpdotnetfreak.blogspot.com</NavigateUrl>
    <AlternateText>AdRotator Control sample ads  </AlternateText>
    <Impressions>30</Impressions>
    <Keyword>Asp.Net</Keyword>

  </Ad>

</Advertisements>

No comments:

Post a Comment