By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,253 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,253 IT Pros & Developers. It's quick & easy.

How to achieve multiple select using DDL or even HTML Select

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.