Hello.
My application has several list pages where a Grid control is used.
Sorting, filtering and column choose are working with no problem (I set the EnablePersistence property to true).
Only one of these forms are filtering also when exporting to Excel or Pdf, the other, not (I have to say that column choosing is working).
Any idea on what can be happening and how to fix it??
This is the code on my Page_Load method;
this.Title = ResourceReader.GetWebResourcesString("Almacenes");
grid.Locale = CultureInfo.CurrentCulture.Name;
if (grid.FilterSettings.FilteredColumns.Count == 0)
{
grid.FilterSettings.FilteredColumns.Add(new FilteredColumn { Field = "IsActive", Operator = FilterOperatorType.Equals, Value = true });
}
warehouseList = Mapper.Map<List<WarehouseListViewModel>>(RepositoryFactory.WarehousesRepository.Get());
grid.DataSource = warehouseList;
grid.DataBind();
This is the code on my ServerExcelExporting (for Pdf is almost the same)
GridProperties gridModel = grdWarehouses.Model;
IEnumerable dataSource = (IEnumerable)grdWarehouses.DataSource;
string fileName = $"{ResourceReader.GetWebResourcesString("Almacenes")}.pdf";
doExportToPdf(gridModel, dataSource, fileName);
And, finally, this is the code for my doExportToPdf method (which is located on the base page where my pages inherits from):
protected void doExportToExcel(GridProperties gridModel, IEnumerable dataSource, string sheetName, bool printHiddenColumns=false, bool printTemplateColumns = true)
{
bool multipleExport = false;
string fileName = $"{sheetName}.xlsx";
ExcelExport exp = new ExcelExport();
IWorkbook workbook = exp.Export(gridModel, dataSource, fileName, ExcelVersion.Excel2013, printHiddenColumns, printTemplateColumns, theme, multipleExport);
}
Thanks in advance