Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ListItem attributes in DropDownList not being persisted

Reply
Thread Tools

ListItem attributes in DropDownList not being persisted

 
 
Bob Krug
Guest
Posts: n/a
 
      10-04-2003
I have a DropDownList control to which I am adding 2 ListItems. For each
List Item I am setting the Value and Text as well as adding an attribute.
My code looks something like this:

Dim objItem as new ListItem
objItem.value = "1"
objItem.Text = "Value 1"
objItem.attributes("CrossRefValue") = "A"

MyDropList.items.add(objItem)

I do the same thing for the second item in the drop list. The problem is
that the attributes no longer exist after postback. The text & value
properties are still there, but no attributes. If I apply attributes to a
TextBox they persist between postbacks, why not the list items? Are
attributes not really supported for drop list items? I looked at the html
source of the rendered page and I don't see my attributes as part of the
"options" tag of the select object.

Thanks,
Bob



 
Reply With Quote
 
 
 
 
mbalam
Guest
Posts: n/a
 
      10-04-2003
do you have viewstate = true ?
>-----Original Message-----
>I have a DropDownList control to which I am adding 2

ListItems. For each
>List Item I am setting the Value and Text as well as

adding an attribute.
>My code looks something like this:
>
>Dim objItem as new ListItem
>objItem.value = "1"
>objItem.Text = "Value 1"
>objItem.attributes("CrossRefValue") = "A"
>
>MyDropList.items.add(objItem)
>
>I do the same thing for the second item in the drop

list. The problem is
>that the attributes no longer exist after postback. The

text & value
>properties are still there, but no attributes. If I

apply attributes to a
>TextBox they persist between postbacks, why not the list

items? Are
>attributes not really supported for drop list items? I

looked at the html
>source of the rendered page and I don't see my attributes

as part of the
>"options" tag of the select object.
>
>Thanks,
>Bob
>
>
>
>.
>

 
Reply With Quote
 
 
 
 
Bob Krug
Guest
Posts: n/a
 
      10-04-2003
Yes. Probably should have mentioned that, but I do have viewstate = true.
The list item values/text are coming back fine.


"mbalam" <(E-Mail Removed)> wrote in message
news:089801c38a2a$c21aed70$(E-Mail Removed)...
> do you have viewstate = true ?
> >-----Original Message-----
> >I have a DropDownList control to which I am adding 2

> ListItems. For each
> >List Item I am setting the Value and Text as well as

> adding an attribute.
> >My code looks something like this:
> >
> >Dim objItem as new ListItem
> >objItem.value = "1"
> >objItem.Text = "Value 1"
> >objItem.attributes("CrossRefValue") = "A"
> >
> >MyDropList.items.add(objItem)
> >
> >I do the same thing for the second item in the drop

> list. The problem is
> >that the attributes no longer exist after postback. The

> text & value
> >properties are still there, but no attributes. If I

> apply attributes to a
> >TextBox they persist between postbacks, why not the list

> items? Are
> >attributes not really supported for drop list items? I

> looked at the html
> >source of the rendered page and I don't see my attributes

> as part of the
> >"options" tag of the select object.
> >
> >Thanks,
> >Bob
> >
> >
> >
> >.
> >



 
Reply With Quote
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-06-2003
Hi Bob,

Based on my research and experience, this issue is a limitation. Please
refer to the following URL for the detailed information:

http://www.dotnet247.com/247referenc.../13/68348.aspx

Does it answer your question?

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ĘC www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
Bob Krug
Guest
Posts: n/a
 
      10-06-2003
Yes, that is the information I am looking for! The only other question is
how do I find out when the problem has been fixed? I would like to stop
using my "custom" drop list when MS has fixed the limitation - Is there some
sort of mailing list I can get on for resolution of known issues?

Thanks,
Bob

"Jacob Yang [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Bob,
>
> Based on my research and experience, this issue is a limitation. Please
> refer to the following URL for the detailed information:
>
> http://www.dotnet247.com/247referenc.../13/68348.aspx
>
> Does it answer your question?
>
> If I have misunderstood your concern, please feel free to let me know.
>
> Best regards,
>
> Jacob Yang
> Microsoft Online Partner Support
> Get Secure! ĘC www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>



 
Reply With Quote
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-07-2003
Hi Bob,

I am very glad to know that the information is helpful to you. For your
last question, unfortunately, there is not such a mailing list. In general,
there will be a published Knowledge Base article when a known issue is
fixed. Please pay more attention to the Microsoft Web Site. Thank you for
your understanding.

In addition, you can send feedback for our products via the following URL:

http://register.microsoft.com/mswish...=EN-US&gssnb=1

I hope it helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ĘC www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-08-2003
Hi Bob,

Please pardon my last post. I wrote "Please pay more attention to the
Microsoft Web Site". I realize that our web site is too large to watch
closely. I have an additional suggestion for you. Watch for updates to the
NET framework, such as service packs. Each time you install one, retest
this issue.

With this you have two ways to watch for this being fixed; watch for an
article and retest after installing updates. Between these methods, you
should become aware of the fix shortly after it is made available.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ĘC www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
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
Selected ListItem in DropDownList does not appear selected Nathan Sokalski ASP .Net 0 10-05-2008 10:29 PM
Bound dropdownlist inside DetailsView control not displaying ListItem added via Insert() donet programmer ASP .Net 0 10-25-2007 04:55 PM
<asp:ListItem Value="0">blank choice</asp:ListItem> ? Jim in Arizona ASP .Net 7 11-22-2006 08:31 AM
Re: Attributes.Add not rendering for RadioButtonList ListItem Karl ASP .Net 0 09-02-2004 08:44 PM
ropdownlist listitem.value not working - returns listitem.text instead Mad Scientist Jr ASP .Net 2 06-29-2004 01:13 PM



Advertisments