We are supposed to add an AdRotator to a web page that displays a book cover. This control is not in our book, so I am going on my own research. Here are the steps I have taken:
Added book cover images to an Ad file inside my App_Data directory.
Given permissions for anyone to view the image folder
Written the following XML file:
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>~\App_Data\Ads\1.jpg</ImageUrl>
<NavigateUrl>http://www.google.com</NavigateUrl>
<Impresions>20</Impresions>
<Keyword>Asp.NET</Keyword>
</Ad>
<Ad>
<ImageUrl>~\App_Data\Ads\2.jpg</ImageUrl>
<NavigateUrl>http://www.google.com</NavigateUrl>
<Impresions>20</Impresions>
<Keyword>Asp.NET</Keyword>
</Ad>
<Ad>
<ImageUrl>~\App_Data\Ads\3.jpg</ImageUrl>
<NavigateUrl>http://www.google.com</NavigateUrl>
<Impresions>20</Impresions>
<Keyword>Asp.NET</Keyword>
</Ad>
<Ad>
<ImageUrl>~\App_Data\Ads\4.jpg</ImageUrl>
<NavigateUrl>http://www.google.com</NavigateUrl>
<Impresions>20</Impresions>
<Keyword>Asp.NET</Keyword>
</Ad>
<Ad>
<ImageUrl>~\App_Data\Ads\5.jpg</ImageUrl>
<NavigateUrl>http://www.google.com</NavigateUrl>
<Impresions>20</Impresions>
<Keyword>Asp.NET</Keyword>
</Ad>
</Advertisements>
On the web page, in the Content PlaceHolder area (using a Master Page), I added an AdRotator control, and linked it to an XMLDataSource that points to my XML advertisements file.
Here is the markup for that:
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Advertisement.xml"></asp:XmlDataSource>
<asp:AdRotator ID="AdRotator1" runat="server"
DataSourceID="XmlDataSource1" NavigateUrlField="http:/www.google.com" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Am I missing a step? I asked my professor and he said it should work. I would eventually like to add a timer so it rotates the ads, but I have to get the thing working first. I have an Update Panel and a Script Manager in there in anticipation of making the images refresh, but it doesn't work when I remove them, either. I feel like there is a simple step I am missing.. like I need some code in there to tell it to GO!

New Topic/Question
Reply




MultiQuote




|