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

Does Spreadsheet support Modal Validation on server side?

1 Answer 87 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Prashant
Top achievements
Rank 1
Prashant asked on 15 Jun 2016, 03:50 PM

Hi,

I am uploading an excel file and display it into spreadsheet. I want that when i upload an excel file, i fetch the records(say: ABC Class type) from posted file and validate using fluent validation. If there are any validation failure then it will be marked on the spreadsheet.

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 17 Jun 2016, 11:53 AM
Hello Prashant,

The built-in validation of the Spreadsheet works on the client: https://demos.telerik.com/aspnet-mvc/spreadsheet/validation

Nevertheless, when you upload an excel file, the data is exposed via a Workbook instance on the server: https://demos.telerik.com/aspnet-mvc/spreadsheet/server-side-import-export. This instance allows you to access the data and modify it if needed, so you can perform a custom validation at that point.
[HttpPost]
public ActionResult Upload(HttpPostedFileBase file)
{
    var workbook = Workbook.Load(file.InputStream, Path.GetExtension(file.FileName));
    return Content(workbook.ToJson(), Telerik.Web.Spreadsheet.MimeTypes.JSON);
}


Regards,
Slav
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Spreadsheet
Asked by
Prashant
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or