Hello Support,
We have associated a grid to an Column chooser, we want to stored the positions of the columns, so next time we load the application we can get the same position which was selected last.
For eg. We have a grid as follows
ID Description Status Date Year
Suppose we change the cloumn position the grid data would be displayed as follows
ID Description Year Status Date
We want to maintain this state for the next time when we load the gird.
In the column chooser we have set the :
ultraGridColumnChooser1.ColumnDisplayOrder = ColumnDisplayOrder.SameAsGrid
In the column chooser the columns are displayed in proper order ie ID,description , Year, status, date, but when we loop through the columnchooser we get the columns as ID,description , status, date,Year.
Is there any other way we can get the positions of the columns which are visible in the grid or column chooser ?
Note : We tried getting the ColumnVisible position also, but it didnt work as we have few hidden column which are not visible in columnchooser also.
Hi,
I'm not sure I understand what you are asking. It appears that you have set up the ColumnChooser so that it displays the columns in the same order as the grid. So if you want the columns to be in the same order the next time you run your application, what you would do is use the Save and Load methods on the grid's DisplayLayout. You don't have to do anything on the ColumnChooser, you just have to get the columns in the right order on the grid itself.Save and Load will do that for you.
If you want to read the columns in the grid in the order in which they appear, then there are a couple of ways to do it.
The easiest would be to use grid.ActiveColScrollRegion.VisibleHeaders.
Another way would be to use the GetFirstVisibleColumn method on the band, then use GetRelatedVisibleColumn on each column to loop.
Hi Mike
I have an ultragrid on which fieldchooser is enabled, when user checks the particular column it is displayed but when he clicks a button to get data from database the selected column id auto deselected
I want to display the checked column
Plz help!!
Thanks Mike,
You did answer my query. I used GetRelatedVisibleColumn and I got the solution.