Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using ad rotator first time in asp.net and face the problem It runs Successfully but image and alternate text is not displayed on the web. How could i solve it Here is my code:
XML
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
  

  <Ad>
    <Imageurl>
      ~/Images/images.jpg

    </Imageurl>
    <Navigateurl>
      https://www.google.com/

    </Navigateurl>
    <Alternatetext>
      GOOGLE
      
    </Alternatetext>
    <Keyword>Search</Keyword>
    <Impression>1</Impression>
  </Ad>
  <Ad>
    <Navigateurl>
      https://www.google.com/
    </Navigateurl>
    <Alternatetext>
      Google1
    </Alternatetext>
    <Keyword>Search</Keyword>
    <Impression>2</Impression>
  </Ad>
</Advertisements>

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

<!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>
    <table width="100%" align="center">
    <tr>
    <td>
    Examples of Ad Rotator
    </td>
    </tr>
    <tr>
    <td>
    <asp:AdRotator ID="Adrotator1" runat="server" Target="_blank" BorderColor="AliceBlue" BorderStyle="Dotted" BorderWidth="2pt" AdvertisementFile="Adrotator.xml" Height="500px" Width="900px" />
    </td>
    </tr>
    </table>
    </div>
    </form>
</body>
</html>
Posted
Updated 16-Sep-12 19:07pm
v3

1 solution

Your xml file has a issue: The
<ad>
tag must be
<Ad>

Try like this:
XML
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
  <Ad>
    <Imageurl>
      "Images/images.jpg"
    </Imageurl>
    <Navigateurl>
      https://www.google.com/
    </Navigateurl>
    <Alternatetext>
      GOOGLE
    </Alternatetext>
    <Keyword>Search</keyword>
    <Impression>1</impression>
  </Ad>
  <Ad>
    <Navigateurl>
      https://www.google.com/
    </Navigateurl>
    <Alternatetext>
      Google1
    </Alternatetext>
    <Keyword>Search</keyword>
    <Impression>2</impression>
  </Ad>
</Advertisements>
 
Share this answer
 
v2
Comments
AmitGajjar 17-Sep-12 1:12am    
5+ Case sensitive
Prasad_Kulkarni 17-Sep-12 1:24am    
Thank you Amit!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900