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

Problem while exporting with filter, paging options

0 Answers 32 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Top achievements
Rank 1
Aayushi asked on 06 Sep 2010, 08:55 AM

I have found the code to take the export to csv at one of your web documents. Below is the link :

I have implement same thing in my code to take export, and it is working,
But when I filter the grid with option like column name "Name" then in grid the resultant view show the filtered data, but when I export them , it still expoting the previous view data which are before filltering:

Here is the code in my exporttocsv() action method:

public ActionResult exporttocsv(int page, string orderBy, string filter)
IEnumerable details = getList().AsQueryable().ToGridModel(page, 20, orderBy, string.Empty, filter).Data;

// remaining code is same as given on your link onlu column name are changes)


After filtring when exporttocsv() is called by clickng on "ExportToCsv" button. In that method parameter all the all page, string orderBy, string filter are 1,~,~ respectively. As on view we are passing thats . See below

<%= Html.Telerik().Grid(Model)
.ToolBar(commands => commands
.HtmlAttributes(new { id = "export" })
.Text("Export to CSV")
.Action("ExportCsv", "Grid", new { page = 1, orderBy = "~", filter =
"~" }))


So how can I pass at runtime the filter argument, page, order by, so it will export the filtered data.

Aayushi Soni
Asked by
Top achievements
Rank 1
Share this question