Frage



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.

War es hilfreich?

Lösung

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.

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top