您的位置:首页 > 编程语言 > ASP

《Programming ASP.NET》(中文版)笔记二——第五章:高级控件

2010-01-11 14:57 330 查看
MultiView和View控件:

MultiView控件的4个CommandName字段:NextView、PrevView、SwitchViewByID和SwitchViewByIndex。
<asp:Button CommandName="PrevView" ID="btnPrevious4" runat="server" Text="Go to Previous" />
<asp:Button CommandArgument="0" CommandName="SwitchViewByIndex" ID="btnFirst" runat="server" Text="Go to First" />

每一个view控件都声明了OnActivate和Ondeactivate事件处理程序,
<asp:View ID="vwThird" runat="server" OnActivate="ActivateView" OnDeactivate="DeactivateView">

Activate和Deactivate事件处理程序:
protected void ActivateView(object sender, EventArgs e)
{
string str = lblViewActivation.Text;
View v = (View)sender;
str += "View " + v.ID + " activated <br/>";
lblViewActivation.Text = str;
}

protected void DeactivateView(object sender, EventArgs e)
{
string str = lblViewActivation.Text;
View v = (View)sender;
str += "View " + v.ID + " deactivated <br/>";
lblViewActivation.Text = str;
}

Wizard控件
FileUpload控件

AdRotator控件:
该控件会引发AdCreated事件,该事件在每次回发到服务器且控件被创建之后呈现页面之前的引发。
protected void ad_AdCreated(object sender, AdCreatedEventArgs e)
{
if ((string)e.AdProperties["Animal"] != "")
l blAnimal.Text = (string)e.AdProperties["Animal"];
else
l blAnimal.Text = "n.a.";
}
AdProperties属性返回一个Dictionary。当获取AdProperties属性时,它会隐式地调用Dictionary对象的Item方法,它返回一个与字典项相应的值,该字典项的关键字是Animal,该值然后被转换为字符串,在C#中,它使用下面的语法完成:
(string)e.AdProperties["Animal"];

Calendar控件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: