Datagridview - Column chooser

3 Answers 25 Views
CheckedListBox GridView
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Radek asked on 18 Jul 2025, 07:56 AM

Hello,

I want to choose column by checkboxes, something like that:

I

It is possible?

Thank you for your answer

3 Answers, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 18 Jul 2025, 08:33 AM

Hello, Radek,

Yes, you can use ColumnChooser in RadGridView. To enable it, you should set the AllowColumnChooser property to true.

More information is available here: Working with ColumnChooser - RadGridView - Telerik UI for WinForms

By default, it doesn't have a checkbox, but you still can add/remove columns from it:

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Radek
Top achievements
Rank 2
Iron
Iron
Iron
answered on 18 Jul 2025, 08:39 AM

Hello,

I use the default column chooser, but I do not like it.

I think that when I see all columns and I get easily check/uncheck column that it is much easier and clearer than drag&drop

Regards

Radek

Nadya | Tech Support Engineer
Telerik team
commented on 18 Jul 2025, 02:41 PM

Hello, Redek,

Thank you for the provided additional information. Now I understand that you are aware of the existing behavior of Column Chooser but you would like to change it.

Yes, you can customize its behavior by adding a checkboxes. However, by default Column Chooser is not designed to work with checkboxes but via drag-drop. In order to customize it, you can add check boxes but you should then take care of the further implementation and handle the Checkbox_ToggleStateChanged event for further actions such as add/remove columns.

You can use the following code snippet that demonstrates how to add check boxes:

private void RadGridView1_ColumnChooserItemElementCreating(object sender, ColumnChooserItemElementCreatingEventArgs e)
{
    var column = e.Column;
    RadCheckBoxElement checkbox = new RadCheckBoxElement
    {
        IsChecked = column.IsVisible
    };
    checkbox.ToggleStateChanged -= Checkbox_ToggleStateChanged;
    checkbox.ToggleStateChanged += Checkbox_ToggleStateChanged;
    
    e.ItemElement.Children.Insert(0, checkbox);
    e.ItemElement.Padding = new Padding(20, 0, 0, 0);
}

Here you can see the result:

Feel free to customize further for the column chooser and achieve the desired behavior.

I hope this information helps. Let me know if you have other questions.

 

 

0
Radek
Top achievements
Rank 2
Iron
Iron
Iron
answered on 18 Jul 2025, 03:51 PM

Hello,

thank you, code is OK. But it show only hidden columns, it is possible to show all columns in datagridview?

Checked will be hidden and unchecked will be visible (or vice versa)?

Nadya | Tech Support Engineer
Telerik team
commented on 23 Jul 2025, 12:53 PM

Hello, Radek,

With the current implementation, the columns are managed by looking for their visibility property. When a column is presented in the ColumnChooser, it is not visible in the grid and vice versa. Hence, you can not achieve the exact scenario from the picture. Initially, I thought you want to show a check boxes for other purposes. Later, I understand that you need these checkboxes to manage the columns appearance. At this moment ColumnChooser in RadGridView does not provide such behavior as it relies on drag-drop operations. 

However, I found this reasonable and log a feature request on our feedback portal on your behalf: RadGridVew: Provide option to choose columns by checkbox in Column Chooser

You can vote for the item or add your comment to it. I also updated your Telerik Points.

Regards,
Nadya

Tags
CheckedListBox GridView
Asked by
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or