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,
It sounds like you are re-setting the grid's DataSource and do the grid is losing it's layout. Any time you set the DataSource on the grid or do something that causes your DataSource to send a reset notification, the grid has to throw away the layout and create a new layout based on the new data.
The best thing to do is make changes to the grid's data source that do not cause a reset.
But if you cannot do that, then you can save the grid's layout before you reset and the load it again afterward.
You do that using the Save and Load methods on the grid.DisplayLayout.
You will still lose any row-level state information like the expanded, selected, and active states of the rows, but you will be able to maintain the visibility and position of the columns.
Sir I have a grid which is bind to a table, there is a button on the grid which on clicked gets the data from the table..so suppose i open the grid i click get data for a particular date, it fetches the data, gud enuf but sat if i select a column from field chooser option , the column is displayed for that instant but again when i click get data button the new data is fetched and that column disappears.
m i clear now?
I don't understand your question. What do you mean by this?
"when he clicks a button to get data from database the selected column id auto deselected"
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.