Add a filter programatically before export

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

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

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

     

    Regards,

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 26 Apr Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top