ASP.NET HtmlTable Control

Definition and Usage

The HtmlSelect control is used to control the <select> element. In HTML, the <select> element is used to create a dropdown list.

Property

Property Description
Align Specify the alignment method of this table.
Attributes Return all attribute names and value pairs of the element.
BGColor Specify the background color of the table.
Border

Specify the width of the border.

Tip:Setting border="0" can display tables without borders.

BorderColor Specifies the color of the border.
CellPadding Specifies the space between the cell border and 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 an HtmlRowCollection object representing all rows in the table.
runat Specifies that the control is a server control. It must be set to "server".
Style Sets or returns the CSS properties applied to the control.
TagName Returns the tag name of the element.
Visible Boolean value indicating whether the control is visible.
Width Specify the width of the table.

Example

HTMLTable
In this example, we declare two HtmlSelect controls, one HtmlInputButton control, and one HtmlTable control in the .aspx file. Users can select the number of cells and rows. When the submit button is triggered, the submit subroutine is executed. The submit subroutine generates the table based on the user's input.
HTMLTable 2
In this example, we declare an HtmlTable control and an HtmlInputButton control in the .aspx file. 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.