I have a kendo ui grid and would like there to be an export button so that when they export to a CSV they could have the same filtering that is on the grid shown.
I would like the post to accept the KendoGridRequest much like the
[HttpPost]
public JsonResult Grid(KendoGridRequest request)
{
var employees = GetEmployees();
var grid = new KendoGrid<Employee>(request, employees);
return Json(grid);
}
I would like to add an Export button that would use the same filters in the post so
the Export action could also accept the KendoGridRequest and would return a CSV file
[HttpPost]
public ActionResult Export(KendoGridRequest request)
{
var employees = GetEmployees();
var grid = new KendoGrid<Employee>(request, employees);
return ToCsv(grid);
}
the KendoGridRequest class comes from the KendoGridBinder project
Basically you can find all the items (needed to create an KendoGridRequest object) contained in the dataSource field exposed by the object of the Grid and send them when posting your data to the Export action method.
i.e.