How to achieve multiple select using DDL or even HTML Select

  • Thread starter Thread starter Problematic coder
  • Start date Start date
P

Problematic coder

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
 
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
 
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
 
Back
Top