WebForm简单控件,复合控件
简单控件:
1、Label
会被编译成span标签
属性:
Text:文本内容
CssClass:CSS样式
Enlabled:是否可用
Visible:是否可见
___________________________________________________________________________________________________________________________
2、Literal
空的,C#会把里面的Text内容直接作为网页代码传过去,比如Text里面写上<input type="button" />会直接在网页中插入一个按钮
属性:
Text:内容
___________________________________________________________________________________________________________________________
3、TextBox
文本框
属性:
TextMode:SingleLine(普通Text单行文本框)PassWord(密码框)MultiLine(文本域)
___________________________________________________________________________________________________________________________
4、HiddenField
隐藏域
5、Button
提交按钮(控件中没有对应的普通按钮和重置按钮)
6、ImageButton
图片按钮
7、LinkButton
超链接模样的按钮
复合控件:
1、RadioButton 和 RadioButtonList
单选按钮
大多情况下使用后者
绑定数据:
RadioButtonList1.DataSource = 泛型集合;
RadioButtonList1.DataTextField = "Name";
RadioButtonList1.DataValueField = "Code";
RadioButtonList1.DataBind(); - 必须要有
设置选中项:
按照索引选中:
RadioButtonList1.SelectedIndex = slist.Count - 1;
按照value值选中:
RadioButtonList1.SelectedValue = "002";
按照Text选中:
foreach (ListItem li in RadioButtonList1.Items)
{
if (li.Text == "周村")
{
li.Selected = true;
}
}
取出数据:
取出value值
Label1.Text = RadioButtonList1.SelectedValue;
取出Text值
Label1.Text = RadioButtonList1.SelectedItem.Text;
属性:
RepeatDirection:横向或竖向排列
RepeatLayout:编译成表格、流式或者有序无序列表的样式
___________________________________________________________________________________________________________________________
2、CheckBox 和 CheckBoxList
复选按钮
绑定数据源与设置单个选择项同上,如果要设置多个选择项,则需要遍历
foreach (ListItem li in CheckBoxList1.Items)
{
if (li.Selected == true)
{
Label1.Text += li.Text + ",";
}
}
___________________________________________________________________________________________________________________________
3、DropDownList
下拉菜单
与单选按钮列表类似
4、ListBox
多选框
与ChekckBoxList类似
属性:
SelectionMode:设置是否可以多选
WebForm简单控件,复合控件的更多相关文章
- WebForm 简单控件、复合控件
简单控件: Label:被编译成span 样式表里设置lable的高度: display:inline-block; Text --文本 ForeColor --字体颜色 Visible -- ...
- webform简单控件
表单元素: 文本类: text password textarea hidden text,password,textarea实现控件:textbox textmode属性选择password或m ...
- 2017年12月17日 ASP.NET 12个表单元素&&简单控件/复合控件
12个表单元素可以分为三大类 第一类:文本类 <input type = "text" /> //普通文本框 <input type = "passwo ...
- webform 简单控件
html中12个表单元素添加runat="server"后称为控件 Lable 编译之后是 <span></span> 属性:CssClass 编译成 c ...
- Webform(简单控件、复合控件)
一.简单控件: 1.label控件 <asp:Label ID="Label1" runat="server" Text="账 号:" ...
- WebForm 【简单控件】【表单元素】
一.HTML 表单元素复习 (1)文本类 文本框:<input type="text" name="" id="" value=&qu ...
- 【2017-05-18】WebForm的Repeater控件和一些简单控件
一.Repeater控件 1. <%@ %> - 这里面写一些声明和引用的 <% %> - 编写C#代码的 <%= %> - 往界面上输出一个变量的值 <% ...
- 【2017-05-18】WebForm的Repeater控件及简单控件
<%@ %> - 这里面写一些声明和引用的 <% %> - 编写C#代码的 <%= %> - 往界面上输出一个变量的值 <%# Eval("属性名 ...
- WebForm 常用控件
一.简单控件 1.Label(作用:显示文字) Web中: <asp:Label ID="Label1" runat="server" Text=&quo ...
随机推荐
- JUnit4:Test注解的两个属性:expected和timeout
JUnit4:Test文档中的解释: The Test annotation supports two optional parameters. The first, expected, declar ...
- 制作自己的嵌入式Linux电脑_转
制作自己的嵌入式Linux电脑 http://os.51cto.com/art/201409/450334.htm 原文链接:http://blog.jobbole.com/75414/ 包含器件选择 ...
- iOS - NSString去掉回车与换行符
代码展示: 由于服务器返回的字符串有回车与/n自己设置的xib的label显示装不下了,所以初次下策也没通知服务端自己改一下吧. NSString *str = fault.fault_content ...
- commonJS 浏览器实现
commonjs http://www.commonjs.org/ CommonJS JavaScript is a powerful object oriented language with so ...
- Android出现java.net.SocketException: Permission denied报错
是由于权限问题导致的,在manifests中找到AndroidManifest.xml 在manifest节点下新增 <uses-permission android:name="an ...
- C# EasyUI树形结构权限管理模块
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷 学无止境,精益求精 本节和大家探讨下C#使用EasyUI树形结构/Tree构 ...
- 在html中引用分享的链接
怎么说呢,其实我自己本身也不是很懂,这些到网上一搜也是有很多详解的,我就是水水的来~~ 附带:smarty 的 tpl 里面 要直接写 javascript 或 style 要用 literal 标签 ...
- Android开源图表之树状图和饼状图的官方示例的整理
最近由于工作需要,所以就在github上搜了下关于chart的三方框架 官方地址https://github.com/PhilJay/MPAndroidChart 由于工作需要我这里整理了一份Ecli ...
- com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command ' finished with non-zero exit value 1
Error:Execution failed for task ':lenovoAlbum:processReleaseResources'. > com.android.ide.common. ...
- 2-MySQL数据库编码uft-8
mysql> show variables like 'character%'; mysql> show variables like 'collation%'; mysql> st ...