See Also: Table Members
In this topic:
The System.Web.UI.WebControls.Table control allows you to build an HTML table and specify its characteristics in a straightforward manner.
A table can be built at design time given some static content, but the power of a System.Web.UI.WebControls.Table Web server control is often realized when the table is built programmatically with dynamic contents.
If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a border attribute that is set to "0" on the HTML table element.
It is important to remember that any programmatic addition or modification of table rows or cells will not persist across posts to the server. This is because table rows and cells are controls of their own, and not properties of the System.Web.UI.WebControls.Table control. To persist any changes to the table, rows and cells must be reconstructed after each postback. In fact, if substantial modifications are expected, it is recommended that a System.Web.UI.WebControls.DataList, System.Web.UI.WebControls.DataGrid, or System.Web.UI.WebControls.GridView control be used instead of the System.Web.UI.WebControls.Table control. As a result, the System.Web.UI.WebControls.Table class is primarily used by control developers.
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. You can use validation controls to verify user input before displaying the input text in a control. ASP.NET provides an input request validation feature to block script and HTML in 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 Introduction to Validating User Input in ASP.NET Web Pages.
For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.
Example
<asp:Table AccessKey="string" BackColor="color name|#dddddd" BackImageUrl="uri" BorderColor="color name|#dddddd" BorderStyle="