3 Replies - 1903 Views - Last Post: 30 November 2012 - 09:23 AM Rate Topic: -----

#1 synlight  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 89
  • View blog
  • Posts: 582
  • Joined: 14-September 11

AdRotator not displaying

Posted 30 November 2012 - 05:43 AM

I am working on my final project for ASP.NET class.

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!

Is This A Good Question/Topic? 0
  • +

Replies To: AdRotator not displaying

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1048
  • View blog
  • Posts: 4,075
  • Joined: 02-July 08

Re: AdRotator not displaying

Posted 30 November 2012 - 08:43 AM

Wouldn't the path be: DataFile="~/App_Data/Ads/Advertisement.xml"?
Was This Post Helpful? 0
  • +
  • -

#3 synlight  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 89
  • View blog
  • Posts: 582
  • Joined: 14-September 11

Re: AdRotator not displaying

Posted 30 November 2012 - 09:15 AM

View Post_HAWK_, on 30 November 2012 - 10:43 AM, said:

Wouldn't the path be: DataFile="~/App_Data/Ads/Advertisement.xml"?



Oops... I fixed that after I posted and forgot to update.

It's still not working, but I have the file path right.
Was This Post Helpful? 0
  • +
  • -

#4 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1048
  • View blog
  • Posts: 4,075
  • Joined: 02-July 08

Re: AdRotator not displaying

Posted 30 November 2012 - 09:23 AM

More info Here. I believe your missing the XPath for the XmlDatasource.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1