Sample Code?

4 posts, 0 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    Jan 2013

    Posted 14 Jan 2013 Link to this post

    Hello,

    I just downloaded your trial version of the AJAX controls for .NET today.  We have an application that performs uploads of files along with saving associated user entered data for the file that was uploaded.  Previously we were using the SlickUpload control but this product has been sold and isn't supported anymore.

    So, I'm looking at converting our application to use your AsyncUpload component.  Some things that I see that are different is that we upload the file on submit of the page along with the information that the user entered.  So, the process is something like: upload file and display upload progress bar when page is submitted and then after file is uploaded, in the same transaction, update the database with the information that the user entered about the file.

    I saw that you have a few sample programs that combine some aspects of this but it would involve combining multiple demos to achieve what I'd like.  Usually you upload the file automatically in the client code when the file is selected vs having it uploaded it on submit of the page.  Also I couldn't find a good example of uploading the file and then saving associated database information immediately after the upload takes place.  I would need to write a custom HTTP handler for this?  Do you have some sample code for this?

    Thanks for your help in pointing me in the right direction.

    Mike Nelson
  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 14 Jan 2013 Link to this post

    Hi Michael,

    It looks as though you want to save the uploaded files to your server without causing a post back on the page. You can start by getting familiar with the OnClientFileUploaded event. RadAsyncUpload stores the images in a temporary file before a post back has occurred. In the code behind you can access these files and save them to your server at the specified event. You can learn more about all available events on the online documentation.

    Hope I could be of some help,
    Bart
  3. Michael
    Michael avatar
    2 posts
    Member since:
    Jan 2013

    Posted 15 Jan 2013 Link to this post

    Dear Bart,

    Actually I'd like to have the file upload on postback.  So have the file selected without causing an upload of any temporary file and then upload the file and associated information fields when the form is submitted.

    I tried this by setting the ManualUpdate property of the AsyncUpload control and it does call my custom handler when I submit the page but it doesn't call the FileUploaded event after this. 

    I'm unclear if I should be saving the uploaded file and associated information (associated information is saved to the DB) in the custom handler or in the FileUploaded event?  Is there some action in the custom handler that should be executed in order for the FileUploaded server side event to occur?

    Thanks for your help,

    Mike Nelson
  4. Plamen
    Admin
    Plamen avatar
    2959 posts

    Posted 17 Jan 2013 Link to this post

    Hello Mike,

     
    FileUploaded server event is thrown only after postback is initialized- you can also trigger it in the OnClientFilesUploaded.

    Hope this information will be helpful. 

    Kind regards,
    Plamen
    the Telerik team
    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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top