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

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控件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值