Add a filter programatically before export

2 posts, 0 answers
  1. Mauricio
    Mauricio avatar
    -1 posts
    Member since:
    Aug 2015

    Posted 21 Apr 2016 Link to this post

    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();
    09.            grdCct.MasterTableView.ExportToCSV();

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



  2. Pavlina
    Pavlina avatar
    6187 posts

    Posted 26 Apr 2016 Link to this post


    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.

    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top