The error is the missing ADD:
z.Attributes.Add("style", "color:red")
"Vincent" <vi,@sd.cv> schreef in bericht
news:(E-Mail Removed)...
> Hi, thanks but i get the error::
> "property access must assign to the property or use its value"
>
>
> "bruce barker" <(E-Mail Removed)> schreef in bericht
> news:E4C9398F-2A49-4703-8817-(E-Mail Removed)...
>> For i = 1 To 20
>> z = New ListItem("item" & i, i)
>> If i=5 ot i=10 or i=15 then z.Attributes("style","color:red")
>> DropDownList1.Items.Add(z)
>> next
>>
>> -- bruce (sqlwork.com)
>>
>>
>> "Vincent" wrote:
>>
>>> Hi,
>>>
>>> i would like to have a forecolor for each listitem with some values only
>>> of
>>> the dropdownlist:
>>>
>>> If i=5 ot i=10 or i=15 then apply red forecolor to those listitems
>>> otherwise
>>> no color.
>>>
>>> For i = 1 To 20
>>> z = New ListItem("item" & i, i)
>>> DropDownList1.Items.Add(z)
>>> ??
>>> next
>>>
>>> Thanks
>>> Vincent
>>>
>>>
>>>
>
>
|