Articles in this section
Category / Section

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

1 min read

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);

 

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied