Latest web development tutorials

ASP.NET HtmlTable Controls

HTML Server Controls HTML server controls

Definition and Usage

HtmlTable control for controlling the <table> element. In HTML, <table> element is used to create a table.


Attributes

属性 描述
Align 规定此表格的对齐方式。
Attributes 返回该元素的所有属性名称和值对。
BGColor 规定表格的背景颜色。
Border 规定边框的宽度。

提示:设置 border="0" 可显示不带边框的表格!

BorderColor 规定边框的颜色。
CellPadding 规定单元格边框与内容之间的空白。
CellSpacing 规定单元格之间的空白。
Disabled 布尔值,指示是否禁用该控件。默认是 false。
Height 规定表格的高度。
id 控件的唯一 id。
InnerHtml 设置或返回该 HTML 元素的开始标签和结束标签之间的内容。特殊字符不会被自动转换为 HTML 实体。
InnerText 设置或返回该 HTML 元素的开始标签和结束标签之间的所有文本。特殊字符会被自动转换为 HTML 实体。
Rows 返回表示表格中所有行的 HtmlRowCollection 对象。
runat 规定该控件是一个服务器控件。必须被设置为 "server"。
Style 设置或返回被应用到该控件的 CSS 属性。
TagName 返回元素的标签名。
Visible 布尔值,指示该控件是否可见。
Width 规定表格的宽度。


Examples

HTMLTable
In this example, we declare two HtmlSelect control in an .aspx file, a HtmlInputButton control, and one HtmlTable control (remember to control nested HtmlForm control). The number of cells and rows of user-selectable. When the submit button is triggered, the submit subroutine. submit subroutine generates the table based on user input.

HTMLTable 2
In this example, we declare a HtmlTable control and a HtmlInputButton control (remember to control nested HtmlForm control) in an .aspx file. When the submit button is triggered, the submit subroutine. submit subroutine modifies the form of the background color and border color, it will modify the contents of a cell.


HTML Server Controls HTML server controls