We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Export to Excel does not take filters into account

Thread ID:





114343 Nov 13,2013 11:03 PM UTC Feb 24,2018 03:38 PM UTC ASP.NET MVC (Classic) 2
Tags: Grid
Bas Kroes
Asked On November 13, 2013 11:03 PM UTC


I have an MVC4 page with the Syncfusion Grid and some filters around the grid (ListBox). These filters work perfect when using a pager (I declared an OnBeginAction where I store all current filter values in args.data). 

But the default Export to Excel button is not able to do this. It can respond to a OnToolbarClickEvent. But this doesn't give me access to args.data. 

Is there a workaround for this?

Sarath Kumar P [Syncfusion]
Replied On November 21, 2013 12:35 PM UTC

Hi Bas,


Thanks for using Syncfusion products.


We would like to let you know that in toolbar click event for excel check the condition  if (args._currentItemIndex == 0) then save the value in a variable and append the variable to the Excel form. In ExportToExcel action find the appended value in FormCollection  fc variable.


Please refer the below code snippets for your reference.



public ActionResult ExportToExcel(PagingParams args, FormCollection fc)  //find the value in  fc->base->All Keys.



var data = OrderRepository.GetAllRecords().Take(200).ToList();

return data.GridExportToExcel<MvcApplication627.Models.Student>("GridExcel.xlsx", ExcelVersion.Excel2007, args.ExportOption);






<script type="text/javascript" language="javascript">

function ToolbarClick(sender, args) {

if (args._currentItemIndex == 0) {

var excel = "<input type='hidden' name='10000' id='excel'/>";







Please refer our sample from the below link for your reference.




Please let us know if you need further assistance.





Faizan Haider
Replied On February 24, 2018 03:38 PM UTC



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon