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

【asp.net】web控件总结

2010-02-19 11:36 162 查看
AdRotator:

XML中出现的属性:


注意:必须按照以上格式书写xml文件,因为他利用的namespace中这么要求的。

在asp.net中使用xml

<asp:AdRotator ID="Myadr" runat="server"  AdvertisementFile="ads.xml"  />


或则

Button、LinkButtion、ImageButton:

使用方法:

Button

<asp:LinkButton  ID=""  runat="server"  OnClick=" "> Linkbutton   </asp:LinkButton>

LinkButton

ImageButton

<asp:ImageButton  ID=""  runat="server"  ImageUrl="~ "  OnClick=" " />


Calendar:

Panel:

<asp:Panel ID="pan1" runat="server"  Visible="true">

Substitution:

注意:这个控件MethodName中定义的方法有如下要求

① 静态方法

② 方法接受HttpContext类型的参数

③ 方法返回String类型的值

例如:

public static string GetUser(HttpContext context)

{

return context.User.Identity.Name;

}

注意:这里的原理与AJAX有些关系。等深入学习后再回来思考

Wizard:

1、设置StepType时,有Start、Step、Finish,Complete以及Auto五项选择。表示该步骤的属性,

2、将步骤转化为***NaviTemplate后,进行对该步骤页面进行编辑,包括页面内下一步,上一步,完成,取消等事件的响应。

3、DisplaySideBar表示对于边栏的显示。

CheckBox:

<asp:CheckBox ID="CheckBox2" runat="server"  AutoPostBack="True"  Text="example" />

AutoPostBack属性,表示单击控件时,是否自动发回服务器。

常用属性:CheckBox2.checked(返回true or false)

常用事件:OnCheckedChanged="CB_CheckedChanged"

OnLoad="CB_CheckedLoad"

CheckBoxList:

<asp:CheckBoxList  ID="cbl"  runat="server"  AutoPostBack="True"  OnSelectedIndexChanged=" ">

<asp:ListItem>呵呵</asp:ListItem>

<asp:ListItem>嘿嘿</asp:ListItem>

<asp:ListItem>哈哈</asp:ListItem>

</asp:CheckBoxList>

cbl.Items[0].selected(返回 true or false)

cbl.Items[1].Text=?(返回值)

都是利用Items这个属性来调用的;

RadioButton:

如果不写GroupName属性的,该控件每项可以选择一次,且不可以取消。

反之,成为单选控件。

RadioButtonList:

<asp:RadioButtonList  ID="RBtn"  runat="server">

<asp:ListItem> 1 </asp:ListItem>

<asp:ListItem> 2 </asp:ListItem>

<asp:ListItem> 3 </asp:ListItem>

</asp:RadioButtonList>


Items[]来获取属性

与很CheckBoxList很类似,但是这个仅是用于单选,而CheckBoxList可以用于多选
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: