Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / September 2006

Tip: Looking for answers? Try searching our database.

LoadPostData and html <select> with multiple selections

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
studen771 - 22 Sep 2006 18:34 GMT
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
(NameValueCollection xxx) only accepts strings?
Gaurav Vaish (www.EduJiniOnline.com) - 24 Sep 2006 05:32 GMT
> 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
> (NameValueCollection xxx) only accepts strings?

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.

Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.