-
How to get multiple values from HTML Listbox control with ASP
I am using an HTML Listbox control in my ASP page. I am using it with "Allow
Multiple Selections" option set to true. Now I am not clear about the syntax
of ASP that I should use to retrieve the multiple values selected from that
ListBox. I tried statements like:
<%
Response.write Request.Form.Item ("select1")(1)
Response.write Request.Form.Item ("select1")(2)
%>
But it did not work.
Looking forward to a positive answer.
-
Re: How to get multiple values from HTML Listbox control with ASP
Kamal,
<%
For ii = 1 To Request.Form( "Item" ).Count
Response.Write Request.Form( "Item" )( ii )
Next
%>
Is this what you're looking for ? Hope this helps.
Please test it out because I've not done so.
kv-
"Kamal" <kamal@paki.com> wrote:
>
>
>I am using an HTML Listbox control in my ASP page. I am using it with "Allow
>Multiple Selections" option set to true. Now I am not clear about the syntax
>of ASP that I should use to retrieve the multiple values selected from that
>ListBox. I tried statements like:
>
><%
>Response.write Request.Form.Item ("select1")(1)
>Response.write Request.Form.Item ("select1")(2)
>%>
>
>But it did not work.
>Looking forward to a positive answer.
>
-
Re: How to get multiple values from HTML Listbox control with ASP
return value are delimitated by "," for multiple selection.
use split function to get each item.
best regards.
-
Re: How to get multiple values from HTML Listbox control with ASP
> return value are delimitated by "," for multiple selection.
> use split function to get each item.
> best regards.
What happens when the selected items are strings containing ","?
-
Re: How to get multiple values from HTML Listbox control with ASP
The syntax for retrieving multiple values from the list box is
for i=1 to Request.form("listbox name").count
listboxvalue=Request.form("listbox name").item(i)
Response.write listboxvalue & "<br>"
next
"Kamal" <kamal@paki.com> wrote:
>
>
>I am using an HTML Listbox control in my ASP page. I am using it with "Allow
>Multiple Selections" option set to true. Now I am not clear about the syntax
>of ASP that I should use to retrieve the multiple values selected from that
>ListBox. I tried statements like:
>
><%
>Response.write Request.Form.Item ("select1")(1)
>Response.write Request.Form.Item ("select1")(2)
>%>
>
>But it did not work.
>Looking forward to a positive answer.
>
-
Re: How to get multiple values from HTML Listbox control with ASP
Or:
for each item in Request.form("listbox name")
response.write item & "<BR>"
Next
"kiran" <kkolanu@newtonpark.com> wrote:
>
>The syntax for retrieving multiple values from the list box is
>
>for i=1 to Request.form("listbox name").count
> listboxvalue=Request.form("listbox name").item(i)
> Response.write listboxvalue & "<br>"
>next
>
>
>"Kamal" <kamal@paki.com> wrote:
>>
>>
>>I am using an HTML Listbox control in my ASP page. I am using it with "Allow
>>Multiple Selections" option set to true. Now I am not clear about the syntax
>>of ASP that I should use to retrieve the multiple values selected from
that
>>ListBox. I tried statements like:
>>
>><%
>>Response.write Request.Form.Item ("select1")(1)
>>Response.write Request.Form.Item ("select1")(2)
>>%>
>>
>>But it did not work.
>>Looking forward to a positive answer.
>>
>
-
Re: How to get multiple values from HTML Listbox control with ASP
What if you are trying to SET multiple values of a Listbox control? (i.e.,
if a variable contains any of the values in the listbox, then when the listbox
control is loaded, those values are selected?)
"CB" <charlie@buddha.org.uk> wrote:
>
>Or:
>
>for each item in Request.form("listbox name")
> response.write item & "<BR>"
>Next
>
>
>
>"kiran" <kkolanu@newtonpark.com> wrote:
>>
>>The syntax for retrieving multiple values from the list box is
>>
>>for i=1 to Request.form("listbox name").count
>> listboxvalue=Request.form("listbox name").item(i)
>> Response.write listboxvalue & "<br>"
>>next
>>
>>
>>"Kamal" <kamal@paki.com> wrote:
>>>
>>>
>>>I am using an HTML Listbox control in my ASP page. I am using it with
"Allow
>>>Multiple Selections" option set to true. Now I am not clear about the
syntax
>>>of ASP that I should use to retrieve the multiple values selected from
>that
>>>ListBox. I tried statements like:
>>>
>>><%
>>>Response.write Request.Form.Item ("select1")(1)
>>>Response.write Request.Form.Item ("select1")(2)
>>>%>
>>>
>>>But it did not work.
>>>Looking forward to a positive answer.
>>>
>>
>
-
Re: How to get multiple values from HTML Listbox control with ASP
"Kamal" <kamal@paki.com> wrote:
>
>
>I am using an HTML Listbox control in my ASP page. I am using it with "Allow
>Multiple Selections" option set to true. Now I am not clear about the syntax
>of ASP that I should use to retrieve the multiple values selected from that
>ListBox. I tried statements like:
>
><%
>Response.write Request.Form.Item ("select1")(1)
>Response.write Request.Form.Item ("select1")(2)
>%>
Kamal,
>But it did not work.
>Looking forward to a positive answer.
Kamal,
I rather try this way
In your Form
<SELECT NAME=AccountNo SIZE=1 VALUE="Select an Account"
onChange="cboAccountNO=this.options[selectedIndex].value">
<%dim xyz
xyz=Request.Form.Item("AccountNo")
%>
-
Re: How to get multiple values from HTML Listbox control with ASP
"Kamal" <kamal@paki.com> wrote:
>
>
>I am using an HTML Listbox control in my ASP page. I am using it with "Allow
>Multiple Selections" option set to true. Now I am not clear about the syntax
>of ASP that I should use to retrieve the multiple values selected from that
>ListBox. I tried statements like:
>
><%
>Response.write Request.Form.Item ("select1")(1)
>Response.write Request.Form.Item ("select1")(2)
>%>
>
>But it did not work.
>Looking forward to a positive answer.
>
I had something similar to you issue I had a list of names where you could
select more than one name and add it to a User list in another List Box.
All I did was create a for next loop to poll thru the list box finding out
what lines where selected then add then added them to the other list box.
-
Re: How to get multiple values from HTML Listbox control with ASP
"JR" <jr_wheldon@qscaudio.com> wrote:
>
>"Kamal" <kamal@paki.com> wrote:
>>
>>
>>I am using an HTML Listbox control in my ASP page. I am using it with "Allow
>>Multiple Selections" option set to true. Now I am not clear about the syntax
>>of ASP that I should use to retrieve the multiple values selected from
that
>>ListBox. I tried statements like:
>>
>><%
>>Response.write Request.Form.Item ("select1")(1)
>>Response.write Request.Form.Item ("select1")(2)
>>%>
>>
>>But it did not work.
>>Looking forward to a positive answer.
>>
>
>I had something similar to you issue I had a list of names where you could
>select more than one name and add it to a User list in another List Box.
> All I did was create a for next loop to poll thru the list box finding
out
>what lines where selected then add then added them to the other list box.
Hi,
You should use a special attribute of a <select> tag that is like multiselected
or something like that.You can check it in the msdn library.
Raul.
>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|