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.
[controller.cs]
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);
}
[view.cshtml]
<script type="text/javascript" language="javascript">
function ToolbarClick(sender, args) {
if (args._currentItemIndex == 0) {
var excel = "<input type='hidden' name='10000'
id='excel'/>";
$("#GenericListGrid_exportExcel").append(excel);
}
}
</script>
Please refer our sample from the below link for your reference.
Link-Export.zip
Please let us know if you need further assistance.
Regards,
P.Sarathkumar.