一、组合单选 RadioButtonList

单选按钮与简单控件不同,可理解为在集合中放置多对象

例:

<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="true">男</asp:ListItem>
<asp:ListItem Value="false"> 女</asp:ListItem>
</asp:RadioButtonList>

可理解为同listview类似,将listitem集合放到同一组中,达到互斥

属性:1、selected:默认选中

2、RepeatDirection:Horizontal--横向排列Vertical--竖向排列

3、RepeatColumns:列数

赋值:控件对象可理解为每一个为listitem类放在items集合中

(1)控件ID.DataSourse--绑定数据源

控件ID.DataTextField--显示数据

控件ID.DataValueField--程序操作名

控件ID.DataBind()--绑定数据

if(!ispostback){}中

(2)便利绑定:

foreach (对象类 n in 对象集合)
{ text value
ListItem li = new ListItem(n.NationName, n.NationCode);
控件Id.Items.Add(li);
}

取值:控件Id.selectedvalue--选中项的默认值

控件id.selecteditem.text--选中项的显示值

页面每次点击会重新加载,为不重复加载,绑定数据等一次操作续写在

二、CheckBoxList

复选按钮与单选按钮结构一致,取值不同

取值:

foreach (ListItem li in 复选按钮Id.Items)
{
if (li.Selected)
{
Label1.Text += li.Value+ li.Text + "|";
}
}

Autopostback:按钮自动提交

三、DropDownList 下拉列表

DropDownList赋值取值与单选,多选相同,只是无布局属性

webform(复合控件)的更多相关文章

  1. webform 复合控件

    RadioButtonList  单选按钮列表 属性:RepeatColumns 用于布局项的列数(每一行的个数) RepeatDirection 选择Vertical,纵向排列:选择Horizont ...

  2. 【2017-05-19】WebForm复合控件

    自动提交的属性: AutoPostBack="True" 1.RadioButtonList     单选集合 -属性:RepeatDirection:Vertical (垂直排布 ...

  3. WebForm复合控件RadioButtonList、CheckBoxList、DropDownList

    1.RadioButtonList     单选集合 -属性:RepeatDirection:Vertical (垂直排布)/Horizontal (横向排布) RepeatLayout:Table ...

  4. 【2017-05-19】WebForm复合控件、用DropDownList实现时间日期选择。

    自动提交的属性: AutoPostBack="True" 1.RadioButtonList     单选集合 -属性:RepeatDirection:Vertical (垂直排布 ...

  5. Webform(简单控件、复合控件)

    一.简单控件: 1.label控件 <asp:Label ID="Label1" runat="server" Text="账 号:" ...

  6. webform简单、复合控件

    简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 2.Literal 空的,C#会把里 ...

  7. WebForm简单控件,复合控件

    简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 __________________ ...

  8. WebForm 简单控件、复合控件

    简单控件: Label:被编译成span 样式表里设置lable的高度:  display:inline-block; Text  --文本 ForeColor  --字体颜色 Visible  -- ...

  9. WebForm 【复合控件】

    一 复合控件(取值,赋值用法相近)  RadioButtonList      --单选按钮 (一组列表)  <asp:RadioButtonList ID="RadioButtonL ...

随机推荐

  1. WebGL和ThreeJs学习5--ThreeJS基本功能控件

      Threejs 2017年6月6日 15:06 Stats: new Stats();性能监视器,性能测试的方法,引入 Stats.js        http://www.hewebgl.com ...

  2. 【支付专区】之解析微信支付返回xml

    public static Map<String,Object> parseBodyXml2Map(String xml){ Map<String,Object> map = ...

  3. STL基础--String

    String 构造 string s1("Hello"); string s2("Hello", 3); //s2: Hel string s3(s1, 2); ...

  4. flume-source

    1.1 Avro Source 监听Avro端口,从Avro client streams接收events.要求属性是粗体字.利用Avro Source可以实现多级流动.扇出流.扇入流等效果.另外也可 ...

  5. Oracle 存储过程起步

    存储过程的注释不能写在第一行 select后面要有into create or replace procedure DelEmp(v_empno in emp.empno%type) AS No_re ...

  6. 1118 Birds in Forest (25 分)

    1118 Birds in Forest (25 分) Some scientists took pictures of thousands of birds in a forest. Assume ...

  7. python类的全面介绍

    转载:全面介绍python面向对象的编程——类的基础 转载:类的实例方法.静态方法.类方法的区别

  8. (转)开源OpenWRT知识

    原博地址:http://www.thinkingquest.net/article/466 我们都需要使用google提供的搜索,gmail等优质服务.但是由于方墙的存在,使得大家各自搞各自的FQ办法 ...

  9. SAS获取最后一条观测到指定宏

    data theLast; set sashelp.class nobs=last point=last; output; stop; run; data _null_; set theLast; c ...

  10. 使用UtraISO为U盘制作系统启动盘

    安装最新的Ubuntu18.04操作系统: 1.在utraiso软件中打开系统的iso文件: 2.插入U盘: 3.点击[启动]选项卡,选择[写入硬盘映像]: 4.最关键的一步: 刻录校验:打上对勾: ...