469,630 Members | 1,221 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,630 developers. It's quick & easy.

How to achieve multiple select using DDL or even HTML Select

I have a need in an application to have the ability to select multiple
values in some kind of drop down list or maybe even a html type select
box.

I have found there doesn't seem to be an option to do this with a
standard asp.net DDL, however it is possible using a html select box,
the problem then is getting the values selected on the code behind
page.

I think in classic asp it would have been something like this:

Dim i as integer
For i = 1 to request.form("SelectID").Count
response.write Request.Form("selAcadLevel")(i) & "<br>"
Next

I am not sure how to translate this into VB.NET or even if it can be
achieved?

Thanks

Jul 12 '07 #1
2 4301
On Jul 12, 12:39 pm, Problematic coder <gnews...@gmail.comwrote:
I have a need in an application to have the ability to select multiple
values in some kind of drop down list or maybe even a html type select
box.

I have found there doesn't seem to be an option to do this with a
standard asp.net DDL, however it is possible using a html select box,
the problem then is getting the values selected on the code behind
page.

I think in classic asp it would have been something like this:

Dim i as integer
For i = 1 to request.form("SelectID").Count
response.write Request.Form("selAcadLevel")(i) & "<br>"
Next

I am not sure how to translate this into VB.NET or even if it can be
achieved?

Thanks
Just add a unique id (id="myControlName") to the html control and a
runat="server" attribute and you should be able to access the control
normally.

Thanks,

Seth Rowe

Jul 12 '07 #2
On Jul 12, 10:08 am, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Jul 12, 12:39 pm, Problematic coder <gnews...@gmail.comwrote:


I have a need in an application to have the ability to select multiple
values in some kind of drop down list or maybe even a html type select
box.
I have found there doesn't seem to be an option to do this with a
standard asp.net DDL, however it is possible using a html select box,
the problem then is getting the values selected on the code behind
page.
I think in classic asp it would have been something like this:
Dim i as integer
For i = 1 to request.form("SelectID").Count
response.write Request.Form("selAcadLevel")(i) & "<br>"
Next
I am not sure how to translate this into VB.NET or even if it can be
achieved?
Thanks

Just add a unique id (id="myControlName") to the html control and a
runat="server" attribute and you should be able to access the control
normally.

Thanks,

Seth Rowe- Hide quoted text -

- Show quoted text -
Thanks for replying but I am still struggling with this:

Here is what I have so far:

<select id="SelTestName" style="height: 69px" runat="server"
multiple="multiple">
<OPTION VALUE="one">one</OPTION>
<OPTION VALUE="two">two</OPTION>
<OPTION VALUE="three">three</OPTION>
</select>

As soon as I attempt to switch between from source to design I get the
following error:

Cannot create an object of type 'System.Boolean' from its string
representation 'multiple' for the 'multiple' property

The other problem I have is how do I iterate through the values
selected, since 'count' doesn't seem to be supported as in my example
above.

Or am I going down totally the wrong road and is there a better way of
achieving this?

Thanks
Jul 12 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Rolf Wester | last post: by
6 posts views Thread by Ben Hallert | last post: by
6 posts views Thread by Adam Tilghman | last post: by
2 posts views Thread by areef.islam | last post: by
4 posts views Thread by Matt Ratliff | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.