Modifica

Condividi tramite


TableHeaderCell Constructor

Definition

Initializes a new instance of the TableHeaderCell class.

public:
 TableHeaderCell();
public TableHeaderCell ();
Public Sub New ()

Examples

The following example demonstrates how to programmatically add a TableHeaderCell control to a Web page. For a complete, working code example, see the TableRow class overview topic.

// Create a header for the table.
TableHeaderCell header = new TableHeaderCell();
header.RowSpan = 1;
header.ColumnSpan = 3;
header.Text = "Table of (x,y) Values";
header.Font.Bold = true;
header.BackColor = Color.Gray;
header.HorizontalAlign = HorizontalAlign.Center;
header.VerticalAlign = VerticalAlign.Middle;

// Add the header to a new row.
TableRow headerRow = new TableRow();
headerRow.Cells.Add(header);

// Add the header row to the table.
Table1.Rows.AddAt(0, headerRow);  
' Create a header for the table.
Dim header As New TableHeaderCell()
header.RowSpan = 1
header.ColumnSpan = 3
header.Text = "Table of (x,y) Values"
header.Font.Bold = True
header.BackColor = Color.Gray
header.HorizontalAlign = HorizontalAlign.Center
header.VerticalAlign = VerticalAlign.Middle

' Add the header to a new row.
Dim headerRow As New TableRow()
headerRow.Cells.Add(header)

' Add the header row to the table.
Table1.Rows.AddAt(0, headerRow)

Remarks

Use this constructor to create and initialize a new instance of the TableHeaderCell class.

Applies to