RadAsyncUpload - Retain uploaded temp files during validation postback

1 Answer 35 Views
AsyncUpload
Jeff
Top achievements
Rank 3
Bronze
Iron
Iron
Jeff asked on 09 Dec 2024, 05:00 PM

I'm using server side validation for certain controls on an asp.net web form page, which also contains a RadAsyncUpload control. 

When a user clicks save, I check to make sure these certain controls contain a value.  If this fails, we stop the save process and display a message to the user.  

During this process, any files to be uploaded are lost.  I need to retain them.

In the load event following this post back, the RadAsyncUpload control still has the uploaded files, but after fully loading the page, they're gone.

I'm already using the Post back Triggers property and this save button just happens to be the post back trigger.

How can I capture these files and "re-load" them into the control?

1 Answer, 1 is accepted

Sort by
1
Accepted
Rumen
Telerik team
answered on 10 Dec 2024, 11:06 AM

Hi Jeff,

There is a similar forum thread that you might want to review: Retain uploaded files for display after postback.

Please also review the Uploaded File Persistence across Postbacks demo. See how the "Submit your picture information" button gets enabled after the comboboxes items are selected. Only when the Submit button performs the postback then the picture gets processed. Note how the comboboxes have applied AutoPostBack="true" and how the selected jpg image stays untouched during the postback in the asyncupload control.

Also, please ensure that you have set the EnableCustomValidation="true" property of RadAsyncUpload. This property specifies whether to fire the FileUploaded event and process the files if the Page is valid after the server-side validation events.  Remark: The control fires its event and processes the files if the Page is valid after the server-side validation events. If the Page is not valid, the uploaded files are persisted between postbacks.


Regards,
Rumen
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Jeff
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 12 Dec 2024, 08:25 PM

Brilliant!  It worked like a charm.  I used the javascript method to execute the additional hidden button from this forum post:

Retain uploaded files for display after postback

I went with a little bit different approach as I'm not using the Page.IsValid methods.  My server-side validation is completely manual.  However, I was able to retain my upload files across the several postbacks until I clicked the hidden button, which was set as the PostbackTriggers button.

As always, your responses are top notch and have solved my problem.  Cheers!

Tags
AsyncUpload
Asked by
Jeff
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Rumen
Telerik team
Share this question
or