ASp.net 生成页面,服务器控件对应html标签
2009-12-19 18:49
706 查看
Server controls
Besides HTML elements, ASP.NET uses server controls which have similar definition to HTML elements. The important difference between the two is that, unlike HTML elements, server controls are accessible from the code-behind or: the server side. This is determined with runat="server" attribute in their definitions. Server controls have different attributes than HTML elements and they are called properties. For example, Image control (which is equivalent to IMG element) has ImageUrl property instead of SRC attribute. But Visual Studio has very useful feature called intellisense which is some kind of autocomplete for your code and that will help you explore various properties.Imoprtan note: Always style elements using CSS insted of server controls properties.
Server controls are much simpler than you might think. Each server control is rendered to a known HTML element on the client. Here is a list of server controls with their HTML equivalents and selectors that can be used from CSS or jQuery.
Server control | HTML equivalent | CSS/jQuery selector |
---|---|---|
Label | <span> | span |
TextBox | <input type="text"> | input[type="text"] |
TextBox (TextMode="Password") | <input type="password"> | input[type="password"] |
TextBox (TextMode="Multiline") | <textarea> | textarea |
Button | <input type="submit"> | input[type="submit"] |
LinkButton | <a href="postback options"> | a |
ImageButton | <input type="image"> | input[type="image"] |
HyperLink | <a> | a |
DropDownList | <select> | select |
ListBox | <select size="n"> | select |
CheckBox | <input type="checkbox"> with <label> | input[type="checkbox"] |
CheckBoxList | <table> with a list of <input type="checkbox"> | table or table input[type="checkbox"] for items |
RadioButton | <input type="radio"> with <label> | input[type="radio"] |
RadioButtonList | <table> with a list of <input type="radio"> | table or table input[type="radio"] for items |
Image | <img> | img |
ImageMap | <img> | img |
Table | <table> | table |
BulletedList | <UL> or <OL> based on BulletedStyle property | ul or ol |
HiddenField | <input type="hidden"> | input[type="hidden"] |
Literal | Literal doesn't have its HTML equivalent, it is usually used as a placehoder to render HTML generated on the server | |
Calendar | <table> | <table> |
FileUpload | <input type="file"> | input[type="file"] |
相关文章推荐
- ASP.NET 服务器控件对应HTML标签
- ASP.NET 服务器控件渲染到客户端之后对应的HTML标签
- ASP.NET 服务器控件渲染到客户端之后对应的HTML标签
- ASP.NET 服务器控件对应HTML标签
- asp.net脚本获取不到id,服务器控件id生成html页面id控制
- ASP.NET 服务器控件对应HTML标签
- ASP.NET 服务器控件渲染到客户端之后对应的HTML标签讲解
- WEB服务器控件对应生成的HTML标签 及最常应用事例
- asp.net如何获取页面动态生成的服务器控件
- 谈谈Asp.net网站优化二:关于 服务器控件 和 客户端控件(html标签)的选择
- jquery获取ASP.NET服务器端控件dropdownlist和radiobuttonlist生成客户端HTML标签后的value和text值
- 谈谈Asp.net网站优化二:关于 服务器控件 和 客户端控件(html标签)的选择
- jquery获取ASP.NET服务器端控件dropdownlist和radiobuttonlist生成客户端HTML标签后的value和text值
- ASP.NET中服务器控件Table动态生成表格及其属性介绍
- Asp.net动态生成html页面
- Asp.net动态生成html页面
- Asp.net动态生成html页面
- Asp.net动态生成html页面[转]
- Asp.net 前段页面控件 filedset 对应的服务端控件【原】
- 技巧和诀窍:使用ASP.NET 2.0 CSS 控件适配器生成CSS友好的HTML输出