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. Image for the cookie policy date
close icon

Dynamically designing GridGroupingControl at runtime.

Hi,

I want to desing GridGroupingControl at runtime.
The requirements are:
1) Adding columns dynamically.
2) Asigning various properties like width, non-editable etc.
3) Freezing few of the newly added columns.
4) Out of say 100 columns in EntityCollection, I want to bind only 10 columns. i.e how to set "AutogenerateColumns" false?

Waiting for reply.

Thanks and Regards,
Vinod

1 Reply

AD Administrator Syncfusion Team January 10, 2007 09:10 AM UTC

Hi Vinod,

1) Adding columns dynamically.

>>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can make use of Columns property of the GridTableDescriptor to manages(add,remove,move and insert) the columns in the grid. You can use gridGroupingControl1.TableDescriptor.Columns.Add to add the column to the grid and then use gridGroupingControl1.TableDescriptor.Columns.Insert to insert it somewhere else in the collection.

If you want to move columns in the Columns collection, then try using TableDescriptor.Columns.Move.

//move "Col2" to position 2 in the Columns collection
int col4 = gridGroupingControl1.TableDescriptor.Columns.IndexOf("Col4");
gridGroupingControl1.TableDescriptor.Columns.Move(col4, 2);
>>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2) Asigning various properties like width, non-editable etc.

>>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Use the TableDescriptor.Columns["ColumnName"].Width property to set the width of the column in a grid. Here is a code snippet.

gridGroupingControl1.TableDescriptor.Columns[0].Width= 100;

How to specify the columns width to be fixed and non-resizable in a grid
>>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

3) Freezing few of the newly added columns.

>>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
The FrozenColumns browser sample (\Essential Studio\4.4.0.49\windows\Grid.Grouping.Windows\Samples\UnderstandingGroupingArchitecture\FrozenColumns\cs ) demonstrates how to freeze the columns in a grid grouping control that is bound to a hierarchical dataset. This feature will allow you to lock specific columns so that they will always be visible on the screen no matter how far you scroll to the right or down.
>>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

4) Out of say 100 columns in EntityCollection, I want to bind only 10 columns. i.e how to set "AutogenerateColumns" false?

>>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please try the attached sample and let me know if you looking something different.
GridSingleColumn.zip
>>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon