I have the following code under a button...However it doesn't "add" the next item onto the listbox - how do I go about just adding to the listbox, one item every postback?
Dim values As New ArrayList()
values.Add(lstrFileName)
lstBox.DataSource = values
lstBox.DataBind()
Hi,
I am not sure whether i got ur question correctly... I have some queries over here.
what is IstrFileName? If it is a file, then what does it contain?
Actually, what "add the next item into the listbox." means?
Please make me clear, so that i can try to help u out.
Tulasi
What I am trying to do is upload a file, in a page and pass the filename to a listbox which shows which files have been uploaded. lstrFileName is a String variable containing the file name. What happens at the minute is that uploading more than one file only binds the last uploaded file to the listbox, i want it to append it on. The sub procedure is a button click.
You're creating a brand new array list each time, adding one element, and binding that to the listbox. Stands to reason you have only one item each time :)
Instead, just add the filename to the items of the listbox, e.g.
lstBox.Items.Add(lstrFileName)
...which assumes that you have not disabled Viewstate for this listbox.
Cheers,
0 comments:
Post a Comment