ASP.NET HtmlTableControl


HTML Server ControlsHTML Server Controls

Definition and Usage

The HtmlTable control is used to control the <table> element. In HTML, the <table> element is used to create tables.


Attributes

Attribute Description
Align Specifies the alignment of this table.
Attributes Returns all attribute name/value pairs for this element.
BGColor Specifies the background color of the table.
Border Specifies the width of the border.

Tip:Setting border="0" displays a table without borders!

BorderColor Specifies the color of the border.
CellPadding Specifies the space between the cell border and its content.
CellSpacing Specifies the space between cells.
Disabled Boolean value indicating whether the control is disabled. The default is false.
Height Specifies the height of the table.
id The unique id of the control.
InnerHtml Sets or returns the content between the start and end tags of the HTML element. Special characters are not automatically converted to HTML entities.
InnerText Sets or returns all text between the start and end tags of the HTML element. Special characters are automatically converted to HTML entities.
Rows Returns the HtmlRowCollection object representing all rows in the table.
runat Specifies that the control is a server control. Must be set to "server".
Style Sets or returns the CSS properties applied to this control.
TagName Returns the tag name of the element.
Visible Boolean value indicating whether the control is visible.
Width Specifies the width of the table.


Examples

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

HTMLTable 2
In this example, we declare an HtmlTable control and an HtmlInputButton control in an .aspx file (remember to nest the controls in an HtmlForm control). When the submit button is triggered, the submit subroutine is executed. The submit subroutine modifies the background color and border color of the table, and it also modifies the content of the cells.


HTML Server ControlsHTML Server Controls Other Extensions