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

Async Upload and returning a viewmodel

1 Answer 284 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Jelly Master
Top achievements
Rank 1
Jelly Master asked on 24 Jun 2014, 05:25 PM
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?

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 26 Jun 2014, 03:40 PM
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:

http://docs.telerik.com/kendo-ui/api/framework/datasource#methods-data

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
Telerik
 

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.

 
Tags
Upload
Asked by
Jelly Master
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or