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

Having multiple AsyncUpload controls on the same page

4 Answers 222 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 04 Jun 2015, 07:35 PM

I'd like to have a multipage that has a tab for different document types. Clicking the "TAB-A" tab would let you select files, then click on "TAB-B" and select more files. When you are all done, click "Upload" and have all the files in each control process.

 I've run into an issue where I'm unable to have multiple events of .FileUploaded. The postback triggers the control's event to start processing but If I add more than 1 and create an event it shows it's not a valid move to have more than one  .FileUploaded events per page.

Am I doing this incorrectly or is it not possible to use multiple AsyncUpload controls on the same page?

 See Photo below where controls 2 & 3 are not happy since it's using the same event as control 1 (not shown)

4 Answers, 1 is accepted

Sort by
0
Jay
Top achievements
Rank 1
answered on 04 Jun 2015, 07:37 PM
Original post was missing the referenced photo
0
Ivan Danchev
Telerik team
answered on 08 Jun 2015, 04:20 PM
Hello,

Please, run the attached sample project, which demonstrates uploading multiple files selected with two RadAsyncUpload controls placed in different RadPageViews.

I tested this scenario with 6 files (3 selected with each RadAsyncUpload) and they were successfully uploaded to the TargetFolder.

Telerik.Web.UI.dll is omitted from the Bin folder in order not to exceed the maximum allowed attachment size.

Regards,
Ivan Danchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jay
Top achievements
Rank 1
answered on 08 Jun 2015, 06:56 PM

I'm not exactly sure I understand. My impression was that you assign a button to initiate a postback and then fire. I want to use the same button for all of the controls, so my guess is I'd have to do this:

1. Create a shared routine to check which controls have files
2. Put that routine inside every .FileUploaded event since only the ones that have files actually fire.
3. Handle the uploads for all controls from whichever event fires?

Does that sound right?

0
Ivan Danchev
Telerik team
answered on 09 Jun 2015, 03:07 PM
Hello,

If RadAsyncUpload's PostbackTriggers property is not set any postback will cause the selected files to be uploaded to the Target folder. So if you perform postbacks on your page but want only clicking the "Upload" button to upload the files (not every postback) then you can set this button as a trigger by passing its ID to the PostbackTriggers property: PostbackTriggers="RadButton1". This would allow you to select files using the RadAsyncUpload on PageView1, select more files with the RadAsyncUpload on PageView2 and after clicking "Upload" all selected files will be uploaded to the Target folder.

If you place break points in both FileUploaded event handlers you will notice that they fire for each uploaded file.

Regards,
Ivan Danchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
AsyncUpload
Asked by
Jay
Top achievements
Rank 1
Answers by
Jay
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or