System.Web.UI.HtmlControls Namespace HtmlTable Class
Sets or retrieves the border width of an HtmlTable control.
Inline |
<table border = intWidth ... > |
Script |
HtmlTable.Border [ = intWidth ] |
intWidth |
Integer specifying the width of the border, in pixels. |
This property is read/write with a default value of -1 ( not set ).
Border is used to specify how wide the border of an HtmlTable control is to be rendered. This property must evaluate to a positive value.
If you do not need a border for the HtmlTable, set this property to either 0 ( no border width ) or simply exclude the property from the declaration.
Border can only be expressed in pixels.
The following example shows how to declaratively set the Border property of an HtmlTable control at design time.
<table cellspacing=1 width="92%" border=1 runat="server">
<tr>
<th>Table header</th></tr>
<tr>
<td>Table data</td></tr>
</table>
The example below demonstrates how to programmatically set the Border property at run time, depending on user input.
void Page_Load ( object Source, EventArgs e ) {
if ( !IsPostBack ) {
for ( int i=5; i<=30; i+=5 ) {
widthSelect.Items.Add ( i.ToString ( ) );
}
widthSelect.Value = "5";
}
myTable.Border = int.Parse ( widthSelect.Value );
}
Show me
HtmlTable Members BorderColor