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

access filter and sort criteria within controller

1 Answer 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 30 Jul 2012, 11:11 PM
I would like to pass the filter and sort criteria to an action using a toolbar custom command. Ultimately, I'd like to export a CSV or Excel file. What is the best way to go about this?

I first tried the following, but it did not work.

The view
@(Html.Kendo().Grid<KendoGridApplication.Models.Order>()
      .Name("Grid")
      .ToolBar(o => o.Custom().Action("Export", "Home").Name("Export"))
      ...

The controller
public ActionResult Export([DataSourceRequest] DataSourceRequest request)
{
  // request.Filters is null
  // request.Sorts is null

1 Answer, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 03 Aug 2012, 08:29 AM
Hello Tyler,

We created a Code Library article which shows how to achieve "Exporting to CSV file". You can download the sample project from here.

I hope this helps.

Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Tyler
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or