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

Passing additional data from Handler to Page

3 Answers 40 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 28 Jan 2014, 06:50 AM
I've implemented a custom handler to save uploaded files to a database, and within the Process function I add the ID of the database row into a custom AsyncUploadResult.

How do I get access to that additional property (ID) from the page (server-side) on postback? The property isn't even appearing in the FileUploaded sub after I cast the UploadResult to my custom version. 

My goal is to save files to the database, and upon submission of the completed web form, iterate through the UploadedFiles collection of the AsyncUpload control and get the individual IDs.

Thanks in advance!

3 Answers, 1 is accepted

Sort by
0
Andrew
Top achievements
Rank 1
answered on 28 Jan 2014, 07:06 AM
[quote]Andrew said: The property isn't even appearing in the FileUploaded sub after I cast the UploadResult to my custom version. 
[/quote]

Apologies! Ignore this part.
0
Andrew
Top achievements
Rank 1
answered on 29 Jan 2014, 02:04 AM
So if I understand this correctly, if I want additional properties added to each upload file, I need to pass the values back to the client from the custom handler using the AsyncUploadResult. This then needs to be trapped by the client-side OnClientFileUploaded method and manually added as an additional field (in my case a hidden input).

Finally on the form submission, I can then use the GetFieldValue function to retrieve the additional property.

I'm not sure if that's how it's supposed to work, but it is for me! :-) 
0
Hristo Valyavicharski
Telerik team
answered on 30 Jan 2014, 12:26 PM
Hi Andrew,

If you implemented a Custom Handler, then the file should be uploaded on the server through the handler? After you insert record in the DB, you should be able to get the ID on the server in the Process method of the handler. Look at this online demo.

Regards,
Hristo Valyavicharski
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
AsyncUpload
Asked by
Andrew
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or