Telerik blogs

Have you ever run into a situation where you needed to allow a user to select which columns they want to see in a grid?  If you are using the RadGridView for WinForms you don’t have to lift a finger to implement this functionality.  The Column Chooser is available for the RadGridView out of the box.  Simply bind your data and you are ready to go.  You can access the Column Chooser by right clicking on any column and selecting Column Chooser from the context menu.  The Column Chooser is displayed as a floating window next to the application. 

image image

You can now drag and drop columns from the grid to the Column Chooser and vice versa to see them removed and restored to the RadGridView.  The feature requires no code to implement.  

 image

You can open the Column Chooser programmatically, if desired, using the ShowColumnChooser method of the RadGridView.  Even better, what if you want to start off with several of the columns already removed from the RadGridView?  Well you can do that too by setting the columns IsVisible property equal to False.  This will hide the column in the grid and when the Column Chooser is opened the columns that are not visible will be displayed to select from.  If you want to make the Column Chooser inaccessible through the context menu, you can set the AllowColumnChooser property equal to False.  The AllowColumnChooser property is located under the RadGridView.MasterGridViewTemplate.  This is a very nice feature that is incorporated into the RadGridView that you might not have known about.


Related Posts

Comments

Comments are disabled in preview mode.