I am developing a window application(C#) in which i am using Syncfusion Grid Grouping Control. I have attached a DataTable to the DataSource property of Grid Grouping Control, the DataTable have 24 columns but i wanted to show only 3 columns in the Grid Grouping Control. I can hide column one by one as follows :
gridGroupingControl1.TableDescriptor.VisibleColumns.Remove(colName);
But this is a long process to hide column one by one if columns count is more. What i want to hide all columns by-default and then show/unhide the columns which i wants ?
Thanks in advance.
You can hide a range of columns using "ColHiddenEntries". Here is the code that could be used to perform the operation.
GridColHidden[] hiddenCols = new GridColHidden[ 3];
for (int i = 0; i < 3; i++)
{
hiddenCols[i] = new GridColHidden(i + 1);
}
this.gridGroupingControl1.TableControl.Model.ColHiddenEntries.AddRange(hiddenCols);
I hope this would simplify your task of removing columns.
One simple way, is to create your columns with the Width property with 0;
column.Width = 0; grid.TableDescriptor.Columns.Add(column);
Works fine for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.