This is a migrated thread and some comments may be shown as answers.

Standard Gridview webform VB multiple file upload

6 Answers 138 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 19 Sep 2011, 09:28 PM
I am using the standard file upload control as a field template in a gridview. I am able to browse for a file from a row in the gridview and then browse for another and upload them but that is backwards. I can only browse for one file at a time and there has to be a row in the grid already. The way the client wanted it to work was to browse for a folder, and have it select all files in the folder or be able to manually select certain files in a folder and click add and have it add that number of rows to the grid with their filename, and file size columns populated with the names. You would then be able to edit things about the row in the grid.

Once you have edited all the information about X number of rows, click upload and have it upload all items in the grid. I thought I could use the AJAX uploader but was having issues binding it to my grid. Is there some other control or can someone suggest a way to make this happen?
 
It looks like the upload for Silverlight might work. Can you select multiple files and then from the list or collection of files add those as rows to a gridview that has other columns other than just file information. I don't do any silverlight development so I don't know if we could create some sort of Silverlight User Control that had the upload functionality that I could call from my webform? 

Below is a link to the form. Basically all the information above the grid pertains to however many documents you add to the grid, then at the end I want to upload the files along with the creation of XML files on the web server etc.

Any help would be greatly appreciated.
 
http://i892.photobucket.com/albums/ac127/orp_album/SCN.jpg

6 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 22 Sep 2011, 03:54 PM
Hello Craig,

The silverlight upload control has the ability to browse the folders (through an open file dialog opened through an user action (Button Click)) and select the files in that folder. It sounds like you do not need the RadUpload's UI, as you will be using a GridView control to present the selected files. The upload control has FilesSelected event that you can use to get the files or bind the GridView's ItemsSource to the Items collection of the RadUpload control. Once the files are ready for upload, you can just call the radUpload.StartUpload() method to upload the files on the server.

Please let me know if you have question on this matter.

Greetings,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Craig
Top achievements
Rank 1
answered on 22 Sep 2011, 04:17 PM
Thanks so much for responding.
So the other question is can I use the silverlight upload control on a webform? The web application is being developed with the 4.0 framework and VB.
Thanks again,
Craig

0
Tina Stancheva
Telerik team
answered on 26 Sep 2011, 04:22 PM
Hello Craig,

You can create a small SL project containing only a RadUpload for Silverlight and host it inside your Web project. When you create the Silverlight project you can check the Host the Silverlight application in a new or existing Web site in the solution check box.


Then you will only need to embed the Silverlight plug-in in the Web page. You can embed the Silverlight plug-in in a Web page in one of two ways:
  • Using the HTML object element.
  • Using the Silverlight.js helper file.
You can read more about integrating Silverlight with a Web Page here. Or if you need more info about how to create a new silverlight project, this article might help.

I hope this info will help you. Let us know if we can further assist you.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Craig
Top achievements
Rank 1
answered on 25 Oct 2011, 04:08 PM
Okay we decided to use the RadUpload and Gridview for Silverlight.

We have a few issues.

1. We bound the gridview to a datatable that contains all of the information about the selected files to upload. When I rebind or reset my source it does not see my changes. Basically when the user selects more files from the upload control I am adding another row to the datatable if the filename from selected files is not already in the table. The datatable appears to be correct but the gridview does not see the changes. I read something about creating a bindinglist instead, is this the answer?

2. In the grid view is there a way to have a different list for each row. Let's say you had a job id column and on one row you wanted the user to get jobid 1,2, and 3 to select from and on the other you wanted to get 4,5, and 6. Is this possible?

3. The grid doesn't seem to allow any editing of the data. Where there is a list you can change a selection but as soon as you go to the next row it reverts back to the previous option. Also where there is text you can change it but again as soon as you go to the next row is reverts back to whatever value it had when it was added to the datatable.

We hired another developer for help with the silverlight controls but they are not working the way we wanted them to at all.





0
Pavel Pavlov
Telerik team
answered on 28 Oct 2011, 03:12 PM
Hello Craig,

On your questions :
1. We bound the gridview to a datatable that contains all of the information about the selected files to upload. When I rebind or reset my source it does not see my changes. Basically when the user selects more files from the upload control I am adding another row to the datatable if the filename from selected files is not already in the table. The datatable appears to be correct but the gridview does not see the changes. I read something about creating a bindinglist instead, is this the answer?

Since we are speaking in the context of Silverlght , and there is no DataTable in Silverlight , I assume you are using a custom implementation of a DataTable.  Typically RadGridView will sense changes in the source , but only if it implements the INotifyCollectionChanged interface (as all ItemsControls in Silverlight) . It seems that is not your case. For cases where the source does not implement INotifyCollectionChanged, we still have a good solution - after making changes - e.g. adding new items, call the Rebind() method of RadGridView.

2. In the grid view is there a way to have a different list for each row. Let's say you had a job id column and on one row you wanted the user to get jobid 1,2, and 3 to select from and on the other you wanted to get 4,5, and 6. Is this possible?

If I get the question right - the answer is Yes, this is supported . You can use a GridViewComboBox column and set its ItemsSource via the ItemsSourceBinding property as described in  this help article

3. The grid doesn't seem to allow any editing of the data. Where there is a list you can change a selection but as soon as you go to the next row it reverts back to the previous option. Also where there is text you can change it but again as soon as you go to the next row is reverts back to whatever value it had when it was added to the datatable.

To be able to help here  I will need to see the objects used as items source for RadGridView. Can you please share the implementation  of the objects in the source collection and the type of this collection as well.


Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Paul
Top achievements
Rank 1
answered on 28 Oct 2011, 03:33 PM
Thanks for the reply. I did not have a chance to update the thread but we changed the datatable class to use your latest lightweight datatable and that took care of everything. I also changed the creation of the columns with VB. I do have some other questions thought about some other aspects of the radcontrols I will start in a new thread.



Tags
Upload
Asked by
Craig
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Craig
Top achievements
Rank 1
Tina Stancheva
Telerik team
Pavel Pavlov
Telerik team
Paul
Top achievements
Rank 1
Share this question
or