Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
750
How to make groups of columns in Grid
posted

There are 42 Columns in my grid. I want to split them into three groups.  I want to show only set of columns at a time and want to make other columns hidden. Its very tedious to write code for every column.

Is there any way to make group of columns.

I have implemented same thing in window ultra grid.

Any suggestions will be higly appreciated..

Thanks

  • 55
    posted

    In the InitializeLayout event, write a ForEach loop to set .Hidden=True on all columns.  Then, switch the .Hidden = False for the columns you wish to display as that group.  You could use either an If or a Select Case to determine which group of columns should be visible to the user at that time.

    Another option is to simply have different queries against your database depending on the columns required.  Call the appropriate query based on your group selection criteria, and set that as your DataSource in the InitializeDataSource event.

    Do this in your code-behind rather than declaratively defining your columns within the ASPX markup for the grid and you shouldn't have any problems.