asp.net.ph

HtmlTable.CellPadding Property

System.Web.UI.HtmlControls Namespace   HtmlTable Class


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

Syntax


Inline <table cellpadding = intPixels ... >
Script HtmlTable.CellPadding [ = intPixels ]

Property Value


intPixels Integer specifying the amount of space, in pixels, between the contents of a cell and the cell's border.

The property is read/write with no default value.

Remarks

Use the CellPadding property to control the spacing between the contents of a cell and the cell's border. The padding 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 padding 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 CellPadding property of an HtmlTable control at design time.

<table cellpadding=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 CellPadding 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 ) {
         paddingSelect.Items.Add ( i.ToString ( ) );
      }
      paddingSelect.Value = "5";
   }
   myTable.CellPadding = int.Parse ( paddingSelect.Value );
}

 Show me 

See Also

HtmlTable Members   CellSpacing 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