|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionIf you have found this article then it means that you could not get the background style of a My solution, however, works just as well with one (known) flaw. The If the handling of attributes for a ASPX<form id="Form1" method="post" runat="server">
<select name="ddlTest" id="ddlTest" runat="server" style="width:125px">
</select>
</form>
Code BehindProtected WithEvents ddlTest As System.Web.UI.HtmlControls.HtmlSelect
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not Me.IsPostBack Then
Dim l As ListItem
l = New ListItem("Lions", "1")
l.Attributes.Add("style", "background: yellow;")
ddlTest.Items.Add(l)
l = New ListItem("Tigers", "2")
l.Attributes.Add("style", "background: orange;")
ddlTest.Items.Add(l)
l = New ListItem("Bears", "3")
l.Attributes.Add("style", "background: brown;")
ddlTest.Items.Add(l)
l = New ListItem("Oh My!", "4")
l.Attributes.Add("style", "background: red; color: white;")
ddlTest.Items.Add(l)
End If
End Sub
That's ItThere's always a solution, even if it is just a quick fix.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||