System.Web.UI.HtmlControls.HtmlTable Class

Allows programmatic access on the server to the HTML <table> element.

See Also: HtmlTable Members


[System.Web.UI.ParseChildren(true, "Rows")]
public class HtmlTable : HtmlContainerControl


Use the System.Web.UI.HtmlControls.HtmlTable control to programmatically control the HTML <table> element on the server. This allows you to create a table on a Web page.

You can dynamically change the appearance of the <table> element by setting the HtmlTable.BgColor, HtmlTable.Border, HtmlTable.BorderColor, HtmlTable.Height, and HtmlTable.Width properties. You can also control how the content of a cell is displayed by setting the HtmlTable.Align, HtmlTable.CellPadding, and HtmlTable.CellSpacing properties.

The rows of the System.Web.UI.HtmlControls.HtmlTable control are stored in the HtmlTable.Rows property of the control. This allows you to programmatically access the individual rows of the table.


A complex table model is not supported. You cannot have an System.Web.UI.HtmlControls.HtmlTable control with nested <caption>, <col>, <colgroup>, <tbody>, <thead>, or <tfoot> elements. These elements are removed without warning and do not appear in the output HTML. An exception will be thrown if you attempt to programmatically add these table model elements to the System.Web.UI.Control.Controls collection of the System.Web.UI.HtmlControls.HtmlTable control.

For a list of initial property values for an instance of System.Web.UI.HtmlControls.HtmlTable, see the HtmlTable.#ctor constructor.


Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0,