Hi,
the dropdownlist is fed by code-behind with roperty 'autopostback'="true". What i want is to put a color to the items of the dropdownlist but only for some values. This code below works: the right items are red, but only the first time. When an user clicks on an item, the postback occurs (property Autopostback) and the dropdownlist is fed again but the color of the items has disappeared. EnabledViewState is set to "true".
i can't use property "forecolor" of the dropdownlist because of the rstriction of some values.
<%@ Page Language="
VB" ... EnabledViewState="true" %@>
<asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="true">
</asp:DropDownList>
code-behind:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
.......
If Page.IsPostBack Then
dd = DropDownList1.SelectedValue
End If
For i = 1 To 10
z = New ListItem(i, i)
If i <= myvar Then z.Attributes.Add("style", "color:red")
DropDownList1.Items.Add(z)
next
........
Thanks
H.