Click to See Complete Forum and Search --> : A problem with multi select listbox
zw1971
10-18-2003, 10:11 PM
I use Dundas Upload in a page with a multi-select list box, and when I tried to retrieve the selected values from the list box, it returns only the first selected one.
Anybody has idea how to fix it?
Thanx
rdoekes
10-19-2003, 09:29 AM
From the Dundas Online documentation, just three clicks from the homepage:
To retrieve multiple selections for one form element (e.g. a listbox) use the Count property of the FormItem object (this will have the total number of items selected for the form element). Use a For loop with the Count property of the FormItem object as the upper loop delimiter and call the Value method for each item. For example, to retrieve all selected elements for a multi-item listbox (named "ListBox") you could use the following syntax:
For i = 0 To objUpload.Form("ListBox").Count - 1
Response.Write objUpload.Form("ListBox").Value(i)
Next
Note: alternatively you could use a For ... Each loop to access these multiple selections. To use a For ... Each loop utilize the following syntax:
For Each Item in objUpload.Form
strSomeVariable = objUpload.Form(Item)
Next