I'm writing a simple web application in C# and I've gotten to the part where I must add an AdRotator object and link four images to it. I have done this, but no matter what I do the images will not show up; only the alternate text. It makes no sense because the paths are correct. Supposedly AdRotator controls are really simple to use... But anyway below is my code.
Search.aspx:
<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Search.aspx.cs" Inherits="Module6.WebForm2" Title="Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<form id="Search" runat="server">
This is the Search page!
<div class="StartCalendar">
<asp:Calendar ID="Calendar1" runat="server" Caption="Start Date" TodayDayStyle-Font-Bold="true"
TodayDayStyle-ForeColor="Crimson" SelectedDayStyle-BackColor="DarkCyan" />
</div>
<div class="EndCalendar">
<asp:Calendar ID="Calendar2" runat="server" Caption="End Date" TodayDayStyle-Font-Bold=开发者_运维问答"true"
TodayDayStyle-ForeColor="Crimson" SelectedDayStyle-BackColor="DarkCyan" />
</div>
<br /><br />
<div class="Search">
<asp:Button ID="btnSearch" runat="server" Text="Search" UseSubmitBehavior="true" />
</div><br /><br />
<div class="CenterAd">
<asp:AdRotator ID="AdRotator1" runat="server" Target="_blank" AdvertisementFile="~/Advertisements.xml" />
</div>
<br /><br />
<div class="Results">
<asp:GridView ID="gvResults" runat="server" />
</div>
</form>
</asp:Content>
Advertisements.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageURL>~/images/colts.jpg</ImageURL>
<AlternateText>Colts Image</AlternateText>
</Ad>
<Ad>
<ImageURL>~/images/conseco.gif</ImageURL>
<AlternateText>Conseco Image</AlternateText>
</Ad>
<Ad>
<ImageURL>~/images/IndianapolisIndians.png</ImageURL>
<AlternateText>Indianapolis Indians Image</AlternateText>
</Ad>
<Ad>
<ImageURL>~/images/pacers.gif</ImageURL>
<AlternateText>Pacers Image</AlternateText>
</Ad>
</Advertisements>
Any and all help is GREATLY appreciated.
So it dawned on me that I apparently COMPLETELY spaced how XML tags are case-sensitive... I could've sworn I saw the ImageUrl tags written "ImageURL" everywhere but then again maybe I just wasn't thinking.
Anyways in case anyone else has a similar issue, the ImageUrl tags are spelled "ImageUrl" and most definitely not "ImageURL".
精彩评论