WebForm的简单控件及其重要属性

Label:会被编译成span
Text:最重要的作用就是显示文本
ForeColor:字体颜色
Visible:是否可见
CssClass:用于设置或返回控件样式类

例如:下面向按钮设置了 CSS 样式:

 1 <style>
 2 .TestStyle
 3   { 
 4   font: 12pt verdana; 
 5   font-weight:700; 
 6   color:orange;
 7   }
 8 </style>
 9 
10 <form runat="server">
11 <asp:Button id="Button" CssClass="TestStyle" 
12 Text="Submit" runat="server"/>
13 </form>

Literal:什么元素都没有,只会在位置上将Text内容完全展示出来
Text


TextBox: 不一定被编译成什么元素

其属性TextMode - 它设置为什么值,被编译后将会是不同的一些表单元素

1、TextMode-singleline:文本框类型

2、TextMode-multiline:多行文本框

3、TextMode-password:密码框

4、TextMode-color:颜色选择框

5、TextMode-data:日期选择框,____年__月__日

6、TextMode-datatimelocal:日期选择框,____年__月__日__时__分

7、TextMode-month:____年__月

8、TextMode-number:限制,只能输入数字

9、TextMode-time:__时__分

10、TextMode-week:____年 第__周

Button:普通按钮
ImageButton:图片按钮
LinkButton:连接按钮

按钮的OnClientClick是执行客户端脚本(js),客户端执行优先级高于服务端

前期回顾——表单元素

文本类:
<input type="text" /> -- 文本框 
<input type="password" /> -- 密码框 
<textarea></textarea> -- 文本域 
<input type="hidden" /> -- 隐藏域

按钮类:
<input type="button" value="普通按钮" />
<input type="submit" value="提交" />
<input type="reset" value="重置" />
<input type="image" src="" />--引号中放图片路径

选择类:
<input type="radio" />--单选框
<input type="checkbox" />--复选框

<select>
<option></option>   --下拉列表,列表中的选择项都要放在<option></option>中
</select>

<input type="file" />--选择文件

原文地址:https://www.cnblogs.com/xtq0313/p/5959724.html