| |||||||
WebControl.BorderColor PropertySystem.Web.UI.WebControls Namespace WebControl Class Sets or retrieves the border color of a Web control. Syntax
Property Value
This property is read/write and returns an empty string if not set. RemarksBorderColor is used to specify the border color of a Web server 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. Note that this property will render only for certain controls. In general, only controls that render as an HTML <table> or <div> element ( block objects ) can display a border color, such as Table, Panel, DataGrid, Calendar, etc. It will also work for list controls that have their RepeatLayout property set to Table, such as the CheckBoxList, RadioButtonList and DataList. This property, however, is rendered as the bordercolor attribute, which is not part of the HTML 3.2 standard. BorderColor works for Internet Explorer version 3 and later, but not for most other browsers.
ExampleThe following example shows how to declaratively set the BorderColor property of a Web control at design time. <asp:panel id = "myPanel" runat = "server" borderstyle = "ridge" borderwidth=3 bordercolor = "beige" /> The example below shows how to programmatically set the BorderColor property 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 src, 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 );
}
}
myTable.BorderColor = Color.FromName ( colorSelect.SelectedItem.Text );
}
See AlsoWebControl Members Style Base Web Control Properties |
| ||||||
Check out related books at Amazon
© 2000-2008 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 aspxtreme