Freigeben über


TableCell Web Server Control Declarative Syntax

Represents a cell in a Table control and allows you to manipulate it programmatically.

<asp:TableCell
    AccessKey="string"
    AssociatedHeaderCellID="string"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
        Inset|Outset"
    BorderWidth="size"
    ColumnSpan="integer"
    CssClass="string"
    Enabled="True|False"
    EnableTheming="True|False"
    EnableViewState="True|False"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
        Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    Height="size"
    HorizontalAlign="NotSet|Left|Center|Right|Justify"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    RowSpan="integer"
    runat="server"
    SkinID="string"
    Style="string"
    TabIndex="integer"
    Text="string"
    ToolTip="string"
    VerticalAlign="NotSet|Top|Middle|Bottom"
    Visible="True|False"
    Width="size"
    Wrap="True|False"
/></asp:TableCell>

Remarks

An instance of the TableCell class represents a cell in a Table control. The cells of each row are stored in the Cells collection of the TableRow representing the row. You can manipulate the contents of a cell by using the Text property.

This class allows you to control how the contents of the cell are displayed. Setting the HorizontalAlign and VerticalAlign properties specifies the horizontal and vertical alignment of the contents in the cell, respectively. You can use the Wrap property to specify whether the contents of the cell automatically continue on the next line when the end of the cell is reached.

You can also specify how many rows or columns a cell occupies in the Table control. The RowSpan and ColumnSpan properties control how many rows and columns are used, respectively.

Warning

Text is not HTML encoded before it is displayed in the TableCell control. This makes it possible to embed script within HTML tags in the text. If the values for the control come from user input, be sure to validate the values to help prevent security vulnerabilities.

For detailed information on the TableCell Web server control's properties and events, see the TableCell class documentation.

Example

The following code example demonstrates how to create a table, add elements to the table programmatically, and display the table on the Web page. Note how TableCell controls are instantiated and their property values are set.

See Also

Reference

TableCell

Other Resources

Web Server Control Syntax