Async Upload and returning a viewmodel

2 posts, 0 answers
  1. Jelly Master
    Jelly Master avatar
    39 posts
    Member since:
    Oct 2010

    Posted 24 Jun 2014 Link to this post

    So my scenario is that I am using the upload helper to do a 1 file upload of an excel file which is fine and dandy.

    Rather than save the file to disk I am reading it into memory and then performing some simple file validation on the server (checking allowed extensions and file size)

    Providing these checks pass I then am parsing the excel document into a dataset using NPOI Excel Helper and then finally converting this dataset into a List<T> where T is my viewmodel for this particular excel document.

    This all works really well but I am wondering how I can pass back the data to the client and then bind it to say a Grid as the documentation for the async process seems to indicate if it finds anything coming back in the content stream then this is classed as an error. So is my only hope to change this to a sync upload and then let the user wait for this process to finish (It can take up to 10 minutes to process a document with 5K lines of data) or is there a way that I can pull back this List collection and bind it to a kendo grid?

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 26 Jun 2014 Link to this post

    Hello David,

    If you want to send the data that you return from the server you should do it through the data method of the Grid's dataSource:

    If you return JSON from the server for the Upload save action, it will be considered as a successful response, the success event will be triggered and you will have the data sent from the server available where you can use the data method mentioned above.

    Kind Regards,
    Petur Subev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top