My problem:
there should be a mult-column list-box type control. the control also has names of images. when the user hits a button, the data in each column is stored in a variable, and all of the images are uploaded to server. Help on execution?

Recommended Answers

All 7 Replies

I take it the user enters the data, possibly including file locations for images? Or is it presented to them by the website and the user is confirming a selection? If you explained exactly what you were trying to achieve we might be able to provide good advice.

the user enters the data, including file locations and images. the file locations/images are uploaded to the server. the data is stored in variables. All of the data is only uploaded after the user hits a button. The data is displayed in a mult-column listbox. Help!

you will need a textbox and file upload control there somewhere if you intend to upload files. I guess you can use a listbox to show the data after the save operation has completed but a listbox isn't really the best way to get the user to enter the data initially.
I would have the file upload control and an add button. The user selects the file they want to upload and clicks add. The data is shown in your list box or a repeater or something similar and the user repeats the opertaion until all the files they want to upload are listed.
They then click save and the file upload and database saving operations take place, drawing the information out of whatever data structure you stored it in.

Ok. I now have all the textboxes and fileuploads required, and an add button. once the button is clicked, data is added to a server-side table. However, the table looses all of its data after the first new row. ( after one more row added, another resets it so that it still has one header row and one other row )
I either need to get that solved somehow, or use some sort of multi-column listbox...


I read your Tread and your problem is not difficult.
See in table we make id primary so to define the rows and columns uniquely.
When the user enters the data just run the insert query and mention where id is @id it will help you and also check the datatype you declare is correct or nor. Else if you need help in code part then just make sure you write a good code for file upload.
If this help you then tell me.

but how do i stop the table from refreshing values?

You can create a data table in a dataset with the same structure as the database table.Every time the user uploads an image the image is stored in the data table.To stop the table from refreshing you store it in a viewstate.You add the details pertaining to the image for storage into the database and then you upload the image to the server for storage in a server bound directory(folder).To retrieve the images you just qualify the image path as that stored in the database in an image tag and bingo!! there you have your image.The code can look as below(

'get structure of database to viewstate
'import all the namespaces for working with the sqlclient class
imports system.text ' for working with the viewstate

dim dstable as new dataset
dim datable as new sqldataadapter

'add datatable to dataset
'fill the datatable with at least one row from the database.something lyk

Select top 1* from the database table

datable.fill(dstable,"database table")

'add the dataset to the viewstate

viewstate.add("viewstate name",dstable)

'create a new datarow each time the user uploads a new file and add it to the dataset.

dim dsnewrow as new datarow


dsnewrow.item("field from database")="a textbox/any control value"

'do this until all the fields have been added


'To update the database you'll need to create a sqlcommandbuilder and pass it your select command as the constructor/argument

'update like

datable.update("database table to update",dstable)

You can then acess the data however you like
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.