asp.net.ph

HtmlTableRow.BorderColor Property

System.Web.UI.HtmlControls Namespace   HtmlTableRow Class


Sets or retrieves the border color of an HtmlTableRow control.

Syntax


Inline <tr bordercolor = strColor ... >
Script HtmlTableRow.BorderColor [ = strColor ]

Property Value


strColor A System.Drawing.Color that represents the border color of the control, using any of the standard .NET color identifiers. See Color Table.

This property is read/write and returns an empty string if not set.

Remarks

BorderColor is used to specify the border color of an HtmlTableRow control. This property is set using a System.Drawing.Color object, the possible range of values of which are specified in this workshop's Color Table.

Setting this property affects all cells in the row. To apply a border color to a single cell, set the BorderColor property for that cell instead.

The Border property of the HtmlTable must be set in order for this property to have any effect.

NOTE: This property is part of the HTML 4.0 standard, and as such will work only in browser versions 4.0 and later.

Example

The following example shows how to declaratively set the BorderColor of an HtmlTableRow control at design time.

<table cellspacing=1 width="92%" border=1 runat="server">
   <tr bordercolor="teal">
      <td>Table data cell 1</td>
      <td>Table data cell 2</td>
   </tr>
</table>

The example below shows how to programmatically set the BorderColor property of each HtmlTableRow at run time, depending on user input. The code also demonstrates how simple it is to retrieve the available colors in .NET ( via the KnownColor enum ), and dynamically add each to a selectable list.

void Page_Load ( object Source, EventArgs e ) {
   if ( !IsPostBack ) {
      Array colors = Enum.GetValues ( typeof ( KnownColor ) );
      foreach ( KnownColor k in colors ) {
         Color c = Color.FromKnownColor ( k );
         if ( !c.IsSystemColor )
            colorSelect.Items.Add ( c.Name );
      }
   }
   // set the border color for each row
   for ( int r = 0; r <= myTable.Rows.Count - 1; r++ ) {
      myTable.Rows [ r ].BorderColor = rowColorSelect.Value; 
   }
}

 Show me 

See Also

HtmlTableRow Members   Border 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