asp.net.ph

HtmlTable.CellSpacing Property

System.Web.UI.HtmlControls Namespace   HtmlTable Class


Sets or retrieves the cell spacing, in pixels, for an HtmlTable control.

Syntax


Inline <table cellspacing = intPixels ... >
Script HtmlTable.CellSpacing [ = intPixels ]

Property Value


intPixels Integer specifying the amount of space, in pixels, between adjacent cells in an HtmlTable.

The property is read/write with no default value.

Remarks

Use the CellSpacing property to control the spacing between individual cells in the HtmlTable control. The spacing amount specified is added to all four sides of the cell.

All cells in a column share the same cell height and width; therefore, the spacing is applied evenly to all cells in the column. Individual cell sizes cannot be specified.

Example

The following example shows how to declaratively set the CellSpacing property of an HtmlTable control at design time.

<table cellspacing=5 width="92%" runat="server">
<tr>
   <th>Table header</th></tr>

<tr>
   <td>Table data</td></tr>
</table>

The example below demonstrates how to programmatically set the CellSpacing property at run time, depending on user input.

void Page_Load ( object Source, EventArgs e ) {
   if ( !IsPostBack ) {
      for ( int i=0; i<=30; i+=5 ) {
         spacingSelect.Items.Add ( i.ToString ( ) );
      }
      spacingSelect.Value = "5";
   }
   myTable.CellSpacing = int.Parse ( spacingSelect.Value );
}

 Show me 

See Also

HtmlTable Members   CellPadding Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph