Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ListItem.AddAttributes has no affect?

13 views
Skip to first unread message

PV

unread,
Mar 1, 2004, 5:13:37 PM3/1/04
to
I am trying to add some attributes to a DropDownList's list items.

For Example
dropdownList1.Items[0].Attributes.Add("myExpandoProperty",
"myExpandoValue");

I would expect then the rendered html to look like:

<select name="dropdownList1" id="dropdownList1">
<option value="test" myExpandoProperty="myExpandoValue">test</option>
</select>

However, the expando property does not show up. What's the point of having
an attributes collection if it does not get rendered in the HTML!?

Any idea how to do this?


Alvin Bruney [MVP]

unread,
Mar 1, 2004, 6:06:58 PM3/1/04
to
That's a well documented bug. There is currently no work around.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"PV" <philipv-REM...@computronix.com> wrote in message
news:uwxCzp9$DHA....@TK2MSFTNGP09.phx.gbl...

PV

unread,
Mar 2, 2004, 10:51:51 AM3/2/04
to
And as an added bonus, it is a sealed class. So I can't inherit from the
thing and implement it properly. Just great.

Any chance of a hotfix?

As it stands, it looks like I would have to implement my own DropDownList
control just so that I can add my own correctly implemented ListItem objects
to it (at least dropdownlist isn't sealed). Would that be a correct
assesment?

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:uuoCrH%23$DHA....@TK2MSFTNGP10.phx.gbl...

Alvin Bruney [MVP]

unread,
Mar 2, 2004, 3:41:17 PM3/2/04
to
You may be able to write to it if you replace the listbox with a select tag.
I've not tried it but i suspect it is better than waiting for a hot fix. The
next hotfix is whidbey which is a while away.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"PV" <philipv-REM...@computronix.com> wrote in message

news:O8k4J5G...@TK2MSFTNGP11.phx.gbl...

0 new messages