using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default6 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void AdRotator1_AdCreated(object sender, AdCreatedEventArgs e)
{
string urlname = e.AlternateText;
string sdt = e.AdProperties["StartDate"].ToString();
string edt = e.AdProperties["EndDate"].ToString();
Response.Write(urlname + "开始日期是:" + sdt + ",结束日期是:" +edt);
}
}
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default6 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void AdRotator1_AdCreated(object sender, AdCreatedEventArgs e)
{
string urlname = e.AlternateText;
string sdt = e.AdProperties["StartDate"].ToString();
string edt = e.AdProperties["EndDate"].ToString();
Response.Write(urlname + "开始日期是:" + sdt + ",结束日期是:" +edt);
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs" Inherits="Default6" %>
<!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>AdRotator</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/App_Data/Ad.xml"
OnAdCreated="AdRotator1_AdCreated" Target="_blank" />
</div>
</form>
</body>
</html>
<!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>AdRotator</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/App_Data/Ad.xml"
OnAdCreated="AdRotator1_AdCreated" Target="_blank" />
</div>
</form>
</body>
</html>
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>~/images/xiaofeng.gif</ImageUrl>
<NavigateUrl>http://www.cnblogs.com/aidd2008</NavigateUrl>
<AlternateText>广告1风</AlternateText>
<KeyWord>第一个</KeyWord>
<Impressions>50</Impressions>
<StartDate>1/5/09</StartDate>
<EndDate>1/8/09</EndDate>
</Ad>
<Ad>
<ImageUrl>~/images/xiaoxun.gif</ImageUrl>
<NavigateUrl>http://aidd2008.cnblogs.com/</NavigateUrl>
<AlternateText>广告2训</AlternateText>
<KeyWord>第二个</KeyWord>
<Impressions>50</Impressions>
<StartDate>1/1/09</StartDate>
<EndDate>1/8/09</EndDate>
</Ad>
</Advertisements>
<Advertisements>
<Ad>
<ImageUrl>~/images/xiaofeng.gif</ImageUrl>
<NavigateUrl>http://www.cnblogs.com/aidd2008</NavigateUrl>
<AlternateText>广告1风</AlternateText>
<KeyWord>第一个</KeyWord>
<Impressions>50</Impressions>
<StartDate>1/5/09</StartDate>
<EndDate>1/8/09</EndDate>
</Ad>
<Ad>
<ImageUrl>~/images/xiaoxun.gif</ImageUrl>
<NavigateUrl>http://aidd2008.cnblogs.com/</NavigateUrl>
<AlternateText>广告2训</AlternateText>
<KeyWord>第二个</KeyWord>
<Impressions>50</Impressions>
<StartDate>1/1/09</StartDate>
<EndDate>1/8/09</EndDate>
</Ad>
</Advertisements>
ImageUrl:广告图片的地址
NavigateUrl:图片上的广告链接地址
AlternateText:鼠标移上去显示的文字
KeyWord:关键字(具体有什么用我也不知道?麻烦知道的提点下)
Impressions:权重,广告图片显示的概率大小于此有关
StartDate/EndDate是自己加的,广告有效期方面用的到
广告控件可以跟数据库绑定
NavigateUrl:图片上的广告链接地址
AlternateText:鼠标移上去显示的文字
KeyWord:关键字(具体有什么用我也不知道?麻烦知道的提点下)
Impressions:权重,广告图片显示的概率大小于此有关
StartDate/EndDate是自己加的,广告有效期方面用的到
广告控件可以跟数据库绑定