Dynamically show and hide columns on the client

1 posts, 0 answers
  1. Tsvetomir
    Tsvetomir avatar
    1 posts
    Member since:
    May 2018

    Posted 04 Oct 2018 Link to this post

    Requirements

    Telerik Product and Version

    UI for ASP.NET AJAX 2018 R3

    Supported Browsers and Platforms

    all browsers supported by Telerik UI for ASP.NET AJAX suite

    Components/Widgets used (JS frameworks, etc.)

    RadGrid, .NET 4.0/4.5 C#

    PROJECT DESCRIPTION

    Changing the structure of the RadGrid control can be achieved only on the server as shown in the Changing the Grid Structure Dynamically on Postback help article. 

    On the client-side, you can dynamically show/hide the columns using showColumn and hideColumn methods of the MasterTableView as demonstrated in this project.

    The scenario that we will be working on is enlisting all columns in a RadCheckBoxList in a RadWindow and based on the check state we will show/hide the column. To achieve that subscribe to the onItemCheckedChanged event of the RadCheckBoxList. Depending on the check state of the checkbox, the specific column is shown/hidden using the methods mentioned above. Optionally, add a button and subscribe to the click event which is used to select/deselect all checkboxes in the checkboxlist.

    * Note that this functionality is supported out of the box when using a header context menu of the RadGrid control
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.