This documentation is archived and is not being maintained.

DropDownList.BorderColor Property

Gets or sets the border color of the control.

[Visual Basic]
Overrides Public Property BorderColor As Color
[C#]
public override Color BorderColor {get; set;}
[C++]
public: __property Color get_BorderColor();
public: __property void set_BorderColor(Color);
[JScript]
public override function get BorderColor() : Color;
public override function set BorderColor(Color);

Property Value

A System.Drawing.Color object that represents the border color of the control.

Remarks

Note   The BorderColor property is inherited from the WebControl class and is not applicable to the DropDownList control.

Example

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<HTML>
    <HEAD>
        <title>Custom DropDownList - BorderColor - VB.NET Example</title>
        <script runat="server">
            Sub Page_Load(sender As Object, e As EventArgs)
                DropDownList1.Items.Add(New ListItem("Item1", "Item1"))
                DropDownList1.Items.Add(New ListItem("Item2", "Item2"))
                DropDownList1.Items.Add(New ListItem("Item2", "Item2"))
            End Sub
        </script>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom DropDownList - BorderColor - VB.NET Example</h3>
            <aspSample:CustomDropDownListBorderColor id="DropDownList1" runat="server" />
        </form>
    </body>
</HTML>
    . . . 
Namespace Samples.AspNet.VB.Controls
Public Class CustomDropDownListBorderColor
    Inherits System.Web.UI.WebControls.DropDownList

    Public Overrides Property BorderColor() As System.Drawing.Color
        ' NOTE: The BorderColor property is inherited from the WebControl 
        ' class and is not applicable to the DropDownList control. 
        Get
            Return MyBase.BorderColor
        End Get
        Set(ByVal Value As System.Drawing.Color)
            MyBase.BorderColor = Value
        End Set
    End Property

    Public Overrides Property BorderStyle() As System.Web.UI.WebControls.BorderStyle
        ' NOTE: The BorderStyle property is inherited from the WebControl 
        ' class and is not applicable to the DropDownList control. 
        Get
            Return MyBase.BorderStyle
        End Get
        Set(ByVal Value As System.Web.UI.WebControls.BorderStyle)
            MyBase.BorderStyle = Value
        End Set
    End Property

    Public Overrides Property BorderWidth() As System.Web.UI.WebControls.Unit
        ' NOTE: The BorderWidth property is inherited from the WebControl 
        ' class and is not applicable to the DropDownList control. 
        Get
            Return MyBase.BorderWidth
        End Get
        Set(ByVal Value As System.Web.UI.WebControls.Unit)
            MyBase.BorderWidth = Value
        End Set
    End Property

    Public Overrides Property ToolTip() As String
        ' NOTE: The ToolTip property is inherited from the WebControl 
        ' class and is not applicable to the DropDownList control. 
        Get
            Return MyBase.ToolTip
        End Get
        Set(ByVal Value As String)
            MyBase.ToolTip = Value
        End Set
    End Property
End Class
End Namespace

[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<HTML>
  <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>
    . . . 
namespace Samples.AspNet.CS.Controls
{
  public 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;
      }
    }
  }
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

DropDownList Class | DropDownList Members | System.Web.UI.WebControls Namespace

Show: