TableCell Class
Assembly: System.Web (in system.web.dll)
The TableCell class represents a cell in a Table control. You can use the Text property to specify or determine the contents of the cell.
The TableCell class allows you to control how the contents of the cell are displayed. The alignment of the contents in the cell are specified by setting the HorizontalAlign and VerticalAlign properties. You can use the Wrap property to specify whether the contents of the cell wrap in the cell.
You can also specify how many rows or columns in the table, represented by a Table control, are occupied by an individual cell. The RowSpan and ColumnSpan properties control how many rows and columns are used, respectively.
Caution |
|---|
| This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see Securing Standard Controls, How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings, and Validating User Input in ASP.NET Web Pages. |
| Topic | Location |
|---|---|
| How to: Customize Individual Days in a Calendar Web Server Control | Building ASP .NET Web Applications |
| How to: Add Rows and Cells Dynamically to a Table Web Server Control | Building ASP .NET Web Applications |
| How to: Customize Individual Days in a Calendar Web Server Control | Building ASP .NET Web Applications |
| How to: Add Rows and Cells Dynamically to a Table Web Server Control | Building ASP .NET Web Applications |
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.
Note |
|---|
| The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Page Code Model. |
- 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.
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
System.Web.UI.WebControls.TableCell
System.Web.UI.WebControls.DataControlFieldCell
System.Web.UI.WebControls.TableHeaderCell
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.
Reference
TableCell MembersSystem.Web.UI.WebControls Namespace
Table Class
Text
HorizontalAlign
VerticalAlign
Wrap
RowSpan
ColumnSpan
Other Resources
Table, TableRow, and TableCell Web Server ControlsSecuring Standard Controls
How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings
Validating User Input in ASP.NET Web Pages
Caution
Note