DropDownList.BorderColor Property
.NET Framework (current version)
Gets or sets the border color of the control.
Assembly: System.Web (in System.Web.dll)
Property Value
Type: System.Drawing.ColorA System.Drawing.Color that represents the border color of the control.
Note |
|---|
The BorderColor property is inherited from the WebControl class and is not applicable to the DropDownList control. |
The following code example demonstrates how to get or set the BorderColor property in a custom DropDownList control. For information about using custom server controls, see Walkthrough: Developing and Using a Custom Web Server Control.
<%@ Page Language="C#" AutoEventWireup="True" %> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Custom DropDownList - BorderColor - C# Example</title> <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { DropDownList1.Items.Add(new ListItem("Item1", "Item1")); DropDownList1.Items.Add(new ListItem("Item2", "Item2")); DropDownList1.Items.Add(new ListItem("Item2", "Item2")); } </script> </head> <body> <form id="Form1" method="post" runat="server"> <h3>Custom DropDownList - BorderColor - C# Example</h3> <aspSample:CustomDropDownListBorderColor id="DropDownList1" runat="server" /> </form> </body> </html>
using System.Web; using System.Security.Permissions; namespace Samples.AspNet.CS.Controls { [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)] public sealed class CustomDropDownListBorderColor : System.Web.UI.WebControls.DropDownList { [System.ComponentModel.Browsable(false)] public override System.Drawing.Color BorderColor { // NOTE: The BorderColor property is inherited from the WebControl // class and is not applicable to the DropDownList control. get { return base.BorderColor; } set { base.BorderColor = value; } } public override System.Web.UI.WebControls.BorderStyle BorderStyle { // NOTE: The BorderStyle property is inherited from the WebControl // class and is not applicable to the DropDownList control. get { return base.BorderStyle; } set { base.BorderStyle = value; } } public override System.Web.UI.WebControls.Unit BorderWidth { // NOTE: The BorderWidth property is inherited from the WebControl // class and is not applicable to the DropDownList control. get { return base.BorderWidth; } set { base.BorderWidth = value; } } public override string ToolTip { // NOTE: The ToolTip property is inherited from the WebControl // class and is not applicable to the DropDownList control. get { return base.ToolTip; } set { base.ToolTip = value; } } } }
.NET Framework
Available since 1.1
Available since 1.1
Show:
