Passing additional data from Handler to Page

4 posts, 0 answers
  1. Andrew
    Andrew avatar
    4 posts
    Member since:
    Jan 2014

    Posted 28 Jan 2014 Link to this post

    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!
  2. Andrew
    Andrew avatar
    4 posts
    Member since:
    Jan 2014

    Posted 28 Jan 2014 in reply to Andrew Link to this post

    Andrew said: The property isn't even appearing in the FileUploaded sub after I cast the UploadResult to my custom version. 


    Apologies! Ignore this part.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andrew
    Andrew avatar
    4 posts
    Member since:
    Jan 2014

    Posted 28 Jan 2014 in reply to Andrew Link to this post

    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! :-) 
  5. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 30 Jan 2014 Link to this post

    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.
Back to Top