System.Web.UI.WebControls Namespace WebControl Class
Sets or retrieves the border style of a Web control.
Inline |
<asp:control BorderStyle = enumValue ... > |
Script |
WebControl.BorderStyle [ = enumValue ] |
enumValue may be any of the BorderStyle enumeration values.
This property is read/write with a default value of NotSet.
BorderStyle is used to specify in what style the border of a Web server control is rendered. This property is set using a BorderStyle enumeration value, the possible values of which are shown above.
A BorderWidth greater than 0 must be set for the BorderStyle attribute to render.
NOTE: This property will not render on browsers earlier than Microsoft® Internet Explorer® 4 for any Web server control. There is no equivalent property in HTML 3.2.
The following example shows how to declaratively set the BorderStyle 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 BorderStyle property at run time, depending on user input. The code also demonstrates how simple it is to retrieve the available system border styles and dynamically add each to a selectable list.
void Page_Load ( Object src, EventArgs e ) {
if ( !IsPostBack ) {
ICollection borders =
TypeDescriptor.GetConverter ( typeof ( BorderStyle ) ).GetStandardValues ( );
foreach ( BorderStyle b in borders ) {
BorderSelect.Items.Add ( b.ToString ( ) );
}
}
myTable.BorderStyle = ( BorderStyle ) BorderSelect.SelectedIndex;
}
Show me
The following example demonstrates use of the BorderStyle property with client-side DHTML events to dynamically modify a control's border style. This sample uses calls to an embedded stylesheet to change the BorderStyle in response to mouse events.
Show me
WebControl Members Style BorderStyle Enumeration Base Web Control Properties