)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to fix a FieldChooser that is not updated while hiding columns using the HideCols property in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: October 14, 2015 |
Last Revised Date: December 31, 2019

Hide columns

The FieldChooser does not update the column values when some of the columns are hidden by using the HideCols property.

 

Columns hidden by using HideCols property

Figure 1: The columns hidden by using HideCols property

In the above image, the column [Product Name] is hidden by using the HideCols property but was not updated in the FieldChooser.

 

Collect the visible columns while hiding the column

Figure 2: While hiding the columns using VisibleColumns collection

The above image displays the column [Product Name] hidden through the VisibleColumns collection and updated in the FieldChooser.

 

Solution:

By default, GridGroupingControl uses VisibleColumns collection to hide the columns. To hide the columns in the GridGroupingControl, you can remove the columns from the VisibleColumns collection, since the FieldChooser of the GridGroupingControl works based on the VisibleColumns collection.  The TableModel.HideCols property does not remove the columns from the VisibleColumns collection, therefore the visibility of the columns is not updated in the FieldChooser.

 

//Hides column using the column name.
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("ColumnName");
//Hides column by using the column index
int columnIndex = 3;
this.gridGroupingControl1.TableDescriptor.VisibleColumns.RemoveAt(columnIndex);

 

 

 

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon