Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ListItem.AddAttributes has no affect?

Reply
Thread Tools

ListItem.AddAttributes has no affect?

 
 
PV
Guest
Posts: n/a
 
      03-01-2004
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?


 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      03-01-2004
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" <(E-Mail Removed)> wrote in message
news:uwxCzp9$(E-Mail Removed)...
> 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?
>
>



 
Reply With Quote
 
 
 
 
PV
Guest
Posts: n/a
 
      03-02-2004
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$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:uwxCzp9$(E-Mail Removed)...
> > 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?
> >
> >

>
>



 
Reply With Quote
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      03-02-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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$(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:uwxCzp9$(E-Mail Removed)...
> > > 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?
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some shareware has a time limit and the software will not work after the time limit has expired. anthony crowder Computer Support 20 01-16-2007 10:01 AM
When a control on form has blank value or has no items (dropdownlist) then it wont' be in Request.Forms TS ASP .Net 3 10-06-2006 01:29 PM
The printing has been stopped and this job has been add to the queu? dejola Computer Support 6 12-30-2005 03:26 AM
Downloaded document has disappeared by the time Word has opened Rob Nicholson ASP .Net 12 12-06-2005 04:59 PM
ZoneAlarm has detected a problem with your installation, and therefore has restricted Internet access from your machine for your protection. Donít panic A Teuchter Computer Support 2 05-19-2005 09:20 PM



Advertisments