To fill the MVC GridView I use Custom Bindings (manually generate and perform sql-query). I need to implement "Export to xls" function. I looked at the example http://mvc.devexpress.com/GridView/Export. Xls document generated in the method called ExportTo:
C#public ActionResult ExportTo() {
foreach(string typeName in GridViewDemosHelper.ExportTypes.Keys) {
if(Request.Params[typeName] != null) {
return GridViewDemosHelper.ExportTypes[typeName].Method(GridViewDemosHelper.ExportGridViewSettings, NorthwindDataProvider.GetInvoices());
}
}
return RedirectToAction("Export");
}
Instead of calling NorthwindDataProvider.GetInvoices() (which returns IQueryable) I need to generate and execute the sql-query.To do this I need to get the current state of sorting and filtering. How can I get this state in ExportTo method?