AdRotator--广告控件

元素 描述
ImageUrl 要显示的图像的URL(必须项)
NavigateUrl 单击AdRotator控件时要打开的页面的URL(可选)
Height 图像的高度(可选)
Width 图像的宽度(可选)
AlternateText 图像不可用时要显示替代文本。在某些浏览器中,该文本显示为提示信息(可选)
Keyword 广告的类别。AdRotator控件使用该属性来筛选显示的特定类别(可选)
Impressions 广告显示的频率,数字越大,显示该广告的频率越高。XML文件中所有<Impressions>值的总和不能超过2047999999(可选)

AdvertisementFile---包含广告的XML文件
AdRotator1_AdCreated方法,在从Asvertisement中检索到广告后激发

protected   void  AdRotator1_AdCreated( object  sender, AdCreatedEventArgs e)
    
{
        
string url = e.AlternateText;
          //String url=e.AdPropertise["AlternateText"].Tostring();
        
string start = e.AdProperties["StartDate"].ToString();
        
string end = e.AdProperties["EndDate"].ToString();
        Response.Write(url 
+ start + end);
    }


广告控件数据源

<? xml version="1.0" encoding="utf-8" ?>
< Advertisements >
  
< Ad >
    
< ImageUrl > ~/img/sina.gif </ ImageUrl >
    
< NavigateUrl > http://www.sina.com </ NavigateUrl >
    
< AlternateText > 新浪网 </ AlternateText >
    
< Keyword > 新闻 </ Keyword >
    
< Impressions > 50 </ Impressions >
    
< StartDate > 6/12/07 </ StartDate >
    
< EndDate > 23/12/08 </ EndDate >
  
</ Ad >
  
< Ad >
    
< ImageUrl > ~/img/qq.gif </ ImageUrl >
    
< NavigateUrl > http://www.qq.com </ NavigateUrl >
    
< AlternateText > 腾讯网 </ AlternateText >
    
< Keyword > 聊天 </ Keyword >
    
< Impressions > 50 </ Impressions >
    
< StartDate > 6/12/07 </ StartDate >
    
< EndDate > 23/12/08 </ EndDate >
  
</ Ad >
  
< Ad >
    
< ImageUrl > ~/img/baidu.gif </ ImageUrl >
    
< NavigateUrl > http://www.baidu.com </ NavigateUrl >
    
< AlternateText > 百度 </ AlternateText >
    
< Keyword > 搜索 </ Keyword >
    
< Impressions > 50 </ Impressions >
    
< StartDate > 6/12/07 </ StartDate >
    
< EndDate > 23/12/08 </ EndDate >
  
</ Ad >
</ Advertisements >


 

你可能感兴趣的:(广告)