ASP.NET HtmlTableCell Control
Definition and Usage
The HtmlTableCell control is used to control <td> and <th> elements. In HTML, these elements are used to create table cells and header cells.
Property
Property | Description |
---|---|
Align | Horizontal alignment of the cell content. |
Attributes | Return all attribute names and value pairs of the element. |
BGColor | The background color of the cell. |
BorderColor | The color of the border. |
ColSpan | The number of columns that the cell should span. |
Disabled | Boolean value indicating whether the control is disabled. The default is false. |
Height | The height of the cell. |
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 the text between the start and end tags of the HTML element. Special characters are automatically converted to HTML entities. |
Nowrap | Boolean value specifying whether the text within the control is wrapped or not. |
RowSpan | The number of rows that the cell should span. |
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. |
VAlign | The vertical alignment of the cell content. |
Visible | Boolean value indicating whether the control is visible. |
Width | Cell Width. |
Example
- HTMLTable
- In this example, we declared 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 declared 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.