ads.xml
复制代码
adRotator.aspx.cs
复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class myTest_advertisement : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ad_Created(object sender, AdCreatedEventArgs e)
{
if ((string)e.AdProperties["Animal"] != "")
Label1.Text = (string)e.AdProperties["Aniaml"];
else
Label1.Text = "n.a.";
}
}
adRotator.aspx
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="adRotator.aspx.cs" Inherits="myTest_advertisement" %>
1、重构菜单:提取方法(Ctrl+R,Ctrl+M) 封装字段(Ctrl+R,Ctrl+F)
2、字典中的关键字是Animal, 该值转化为字符串,
(string).AdProperties["Aniaml"]
上一篇:XML文件如何修改节点属性值