Main Page

  Previous Section Next Section


System.Web.UI.WebControls (system.web.dll)class

This class provides a powerful object model for creating HTML tables. It is similar to, but more abstract than, the System.Web.UI.HtmlControls.HtmlTable class. It also allows ASP.NET to optimize rendering for both down-level and up-level browsers. You can use it to dynamically generate an HTML table by adding TableRow objects to the Rows collection and adding TableCell objects to each row. Note that if you create or modify a table's structure programmatically, these changes will not be preserved across postbacks and you will have to reconstruct them manually; table rows and cells are controls of their own, not properties of Table.

Most other properties for the Table class correspond to formatting options, including a background image (BackImageUrl), alignment (HorizontalAlign), gridlines (GridLines), the spacing between cells (CellSpacing), and the spacing between cell borders and content (CellPadding).

This class is often used by control developers, while the DataGrid and DataList controls are preferred for ASP.NET applications, particularly if data binding is required.

public class Table : WebControl {
// Public Constructors
   public Table( );
// Public Instance Properties
   public virtual string BackImageUrl{set; get; }
   public virtual int CellPadding{set; get; }
   public virtual int CellSpacing{set; get; }
   public virtual GridLines GridLines{set; get; }
   public virtual HorizontalAlign HorizontalAlign{set; get; }
   public virtual TableRowCollection Rows{get; }
// Protected Instance Methods
   protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer);// overrides WebControl
   protected override ControlCollection CreateControlCollection( );  // overrides System.Web.UI.Control
   protected override Style CreateControlStyle( );                // overrides WebControl
   protected override void RenderContents(System.Web.UI.HtmlTextWriter writer);  // overrides WebControl


System.Object System.Web.UI.Control(System.ComponentModel.IComponent, System.IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor) WebControl(System.Web.UI.IAttributeAccessor) Table

      Previous Section Next Section