all groups > asp.net building controls > september 2006 >
You're in the

asp.net building controls

group:

LoadPostData and html <select> with multiple selections


LoadPostData and html <select> with multiple selections studen771
9/22/2006 10:34:03 AM
asp.net building controls: Thanks in advance to anyone else who can help :)

I've got a custom control that contains a PLAIN HTML <select> element that
allows multiple selections (NOT A asp.net listbox, listcontrol or
derivatives, etc.)
Within the LoadPostData method I'm trying to retrieve the values that were
chosen from the <select> element, yet the NameValueCollection parameter that
this method passes only allows for single strings, NOT collections..(at least
to my understanding up to this point)

How is it possible for me to retrieve the items selected out of my <select>
html element in the LoadPostData method when its second parameter
Re: LoadPostData and html <select> with multiple selections Gaurav Vaish (www.EduJiniOnline.com)
9/24/2006 12:00:00 AM
[quoted text, click to view]

The value for the corresponding key contains the entries as a string but in
a comma-separated form.

You may simply do:

string[] allSelectedValues = postCollection.GetValues(postDataKey);

If no values were selected, the array will be null.


--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://www.edujinionline.com
http://articles.edujinionline.com/webservices
-------------------

AddThis Social Bookmark Button