The Table class allows you to build an HTML table and specify its characteristics. A table can be built at design time with static content, but the Table control is often built programmatically with dynamic contents
Each Table control is made up of rows (represented by instances of the TableRow class) stored in the Rows collection of the control. Each row is made up of cells (represented by instances of the TableCell class) stored in the Cells collection of the each TableRow.
Here is some sample code on adding rows and cells to a Table control:
TableCell tcell1 = new TableCell();
tcell1.Text = "Cell1";
TableRow trow1 = new TableRow();
trow1.Cells.Add(tcell1);
table1.Rows.Add(trow1);
You can display an image in the background of the Table control by setting the BackImageUrl property. By default, the horizontal alignment of the items in the table is not set. If you want to specify the horizontal alignment, set the HorizontalAlignment property. The spacing between individual cells is controlled by the CellSpacing property. You can specify the amount of space between the contents of a cell and the cell's border by setting the CellPadding property. To display the cell borders, set the GridLines property. You can display the horizontal lines, vertical lines, or both horizontal and vertical lines.
Text is not HTML encoded before it is displayed in the Table 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.
We can use Server.HtmlEncode(String) to make sure that no direct javascript can be embedded in the HTML because of the use of the control.
Revision number 6, Thursday, June 26, 2008 4:02:20 AM by k_nitin_r
You must Login to comment.
|
Fri, Jun 20, 2008 8:14 AM
by Dynamic2008
|
Good to say that using Server.HtmlEncode(TestString); we can help the security vulnerabilities.
|
Revision #4
Fri, Jun 27, 2008 9:31 PM
by
|
CheckBoxList
The CheckBoxList control creates a multiselection checkbox group that can be dynamically generated using databinding. To specify items that you want to appear in the CheckBoxList control, place a ListItem element for each entry between the opening and closing
|
Revision #2
Mon, Feb 25, 2008 1:22 AM
by
|
XML
Use the XML control to display the contents of an XML document or the results of an XSL Transform. The XML document to display is specified by setting one of three properties. These three properties represent the different types of XML documents that can be
|
New
Wed, Mar 26, 2008 3:56 PM
by
|
SiteMapDataSource
The SiteMapDataSource control is a data source to the site map data that is stored by the site map providers that are configured for your site. The SiteMapDataSource enables Web server controls that are not specifically site navigation controls, such as the
|