>Hi All,
>
>Sorry for my newbie question.
>
>I am trying to set the Border property of a DropDownList Web Control on my .aspx page. Since there are no border settings in the property window I put the following code in behind page :
>
>
>ddlStateSelect.BorderStyle = ddlStateSelect.BorderStyle.NotSet
>ddlStateSelect.BorderWidth = Unit.Pixel(2)
>ddlStateSelect.BorderColor = Color.PowderBlue
>
>
>When I view the page in the browser the Border style/color/width did not change.
>
>TIA,
>Daniel
Daniel
Here you go, this should get you going - This can be applied to border width and many other things
first this
Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList
Private primaryStyle As New Style()
then this in page load
If Not Me.IsPostBack Then
Dim colors As New ListItemCollection()
colors.Add(Color.Black.Name)
colors.Add(Color.Blue.Name)
colors.Add(Color.Green.Name)
colors.Add(Color.Orange.Name)
colors.Add(Color.Purple.Name)
colors.Add(Color.Red.Name)
colors.Add(Color.White.Name)
colors.Add(Color.Yellow.Name)
DropDownList1.DataSource = colors
DropDownList1.DataBind()
End If
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
primaryStyle.BorderColor = _
Color.FromName(DropDownList1.SelectedItem.Text)
primaryStyle.BackColor = _
Color.FromName(DropDownList1.SelectedItem.Text)
primaryStyle.ForeColor = _
Color.FromName(DropDownList1.SelectedItem.Text)
DropDownList1.ApplyStyle(primaryStyle)
End Sub
When you select a color from the dropdownlist then the colors change to what was selected.
Carl
¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°¤º°`°º¤ø¤º°¤º°
Carl Evans
CEO & President
System Answers Consulting, Inc.
MCSD .NET, ASP.NET, C#.NET, VB.NET,