张银的博客


Eat to live, but do not live to eat.

导航

CheckBox(复选按钮)/RadioButton(单选按钮)/BulletedList控件

Posted on 2009-01-09 18:17  张银  阅读(1061)  评论(0编辑  收藏  举报

CheckBox(复选按钮)和RadioButton(单选按钮)一些控件共有的属性
CheckBox
呈现方式-外观:BackColor/BorderColor/BorderStyle/ForeColor/Text/TextAlign(控制文字左右)
自动回传-行为:AutoPostBack(True)/Visible
RadioButton
行为:GroupName(此属性值相同的项才看做一组,否则各自都是一组)


BulletedList控件
和其他的列表控件(比如CheckBoxList)一样,都派生自ListControl类,所以用法以及很多属性也是大同小异的,主要功能就是创建一个无序或者有序(带编号)的列表,他可以直接添加静态项,也可以动态绑定数据
样式:BuletImageUrl(项目符号图像)
添加静态项
行为:DisplayMode(Text/HyperLink/LinkButton)
外观:BulletStyle(NotSet/Numberd/LowerAlpha/UpperAlpha/LowerRoman/UpperRoman/Disc/Circle/Square/CustomImage)

protected void BullentedList_DataBound(object sender, EventArgs e) //如果是HyperLink可能用的到的代码
{
 
for (int i=0; i<BulletedList.Items.Count; i++)
 {
  BullentedList.Items[i].Value 
= "~/write.aspx?id=" + BulletedList.Items[i].Value;
 }
}

 

protected void BulletedList_Click(object sender, BullentedListEventArgs e) //如果是LinkButton可能用的到的代码
{
 Response.Write(BulletedList.Items[e.Index].Text);
}