HtmlTable Class

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

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)

public ref class HtmlTable : public HtmlContainerControl
public class HtmlTable extends HtmlContainerControl
public class HtmlTable extends HtmlContainerControl

Use the 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 BgColor, Border, BorderColor, Height, and Width properties. You can also control how the content of a cell is displayed by setting the Align, CellPadding, and CellSpacing properties.

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

NoteNote

A complex table model is not supported. You cannot have an 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 Control.Controls collection of the HtmlTable control.

For a list of initial property values for an instance of HtmlTable, see the HtmlTable constructor.

The following code example demonstrates how to use an HtmlTable control to display information in a table.

No code example is currently available or this language may not be supported.

The following code example demonstrates how to dynamically create an HtmlTable control.

No code example is currently available or this language may not be supported.

  • AspNetHostingPermission  for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: