public override ActionResult ExportListTo(ExportFormat exportFormat = ExportFormat.Xlsx) { try { ExportType exportType = GridViewHelper.ExportTypes.SingleOrDefault(x => x.Format == exportFormat); var filter = ListState.ListFilter ?? new TListFilter(); var listState = ListState; if (listState.ViewType.HasValue) { string filterString = listState.FilterExpression; var where = GetFilterExpressionState(listState.FilterExpression); //var sortExpression = Common.Code.Utilities.GetSortExpression(listState..SortedColumns, DefaultSortExpressionState()); //var filterString = GetFilterExpressionState(e.State.FilterExpression); var applicationList = _listApplicationRepository.GetFilteredApplications(where); var gridviewSettings = CreateListExportSettings(); if (gridviewSettings != null && exportType != null) { return(exportType.Method(gridviewSettings, applicationList)); } } GlobalAlertMessage = "Exporting failed"; } catch (Exception e) { LogHelper.WriteError(e); } return(SetRedirect("Index")); }