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

Add a filter programatically before export

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mauricio
Top achievements
Rank 1
Mauricio asked on 21 Apr 2016, 03:45 PM

I need to export my already filtered data grid, but my requirement says that inactive records should not be exported, so i'm trying to do this :

 

01.            grdCct.ExportSettings.IgnorePaging = true;
02.            grdCct.ExportSettings.ExportOnlyData = true;
03.            grdCct.ExportSettings.Csv.FileExtension = "csv";
04.            grdCct.ExportSettings.FileName = "Export_" + DateTime.Now.ToShortDateString();
05.// Column 6 is my "Active" column as text "Y/N"
06.            grdCct.Columns[6].CurrentFilterValue="Y";
07.            grdCct.MasterTableView.Rebind();
08. 
09.            grdCct.MasterTableView.ExportToCSV();

Can anybody tell me the correct way to accomplish this?.

 

Regards,

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 26 Apr 2016, 04:27 PM
Hi,

To achieve your goal you can try using global boolean variable in the ItemDataBound event of the grid where the custom logic for hiding inactive records is executed. Then you have to use a flag to ensure that the export-specific code runs only during export. Give this suggestion a try and let me know if you need additional assistance.

Regards,
Pavlina
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Mauricio
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or