Show/Hide ColumnGroups

2 posts, 0 answers
  1. Savi
    Savi avatar
    1 posts
    Member since:
    Jul 2016

    Posted 28 Jul 2016 Link to this post

    I've got a RadGrid with programmatically generated columns, including a variable number of column groups.
     Each of the column groups contains two/three columns, and I want to hide the columns along with the associated ColumnGroup.
    Above the RadGrid I have a series of checkboxes, one for each column group. The goal is to have the user
     check or uncheck the boxes depending on what columns they wish to see. Currently I am setting the columns
    ' Display properties when a checkbox's checked value is changed by using 

    And also tried radgrid.MasterTableView.ColumnGroups.FindGroupByName("colGroupname").Display = False but there is no 
    Display property for that and the Visible property is ReadOnly. So I managed to hide ColumnGroup by applying
    CSS class to hide the Column group.

    But the export to excel is not reflecting the hidden group and also it reshuffles the columns into excel file.
    So please suggest the option to hide the Column group into export file or any alternate option to achieve the same.
  2. Eyup
    Eyup avatar
    4046 posts

    Posted 02 Aug 2016 Link to this post

    Hi Savi,

    Try to use the ItemCommand event to capture the e.CommandName == RadGridPdfExportCommand argument and hide them again. Or use the PreRender event handler of the grid with the RadGrid1.IsExporting condition in an if statement and then hide the required elements. Also, you can try to hide the columns directly, not the ColGroups:

    Telerik by Progress
    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