Hi, as I browsed, I found that I can use column choose dialog for hiding column functionality that the user can use. But I need to hide certain columns inside the code, not let the user choose it. I assume since the column choose dialog can do it, I should be able to do it too. But can't find any reference. Could you please provide me any directions?
Also, the band and overriden properties, are they only available at design time and through the initializelayout event? Can't I directly access them like any other property?
Thanks in advance.
To hide a column set column.Header.Hidden = true.
You can access the band by grid.DisplayLayout.Bands[0], or 1 or 2 if you have more than one.
What do you mean "overriden properties"?
Amiram Korach said: To hide a column set column.Header.Hidden = true. You can access the band by grid.DisplayLayout.Bands[0], or 1 or 2 if you have more than one. What do you mean "overriden properties"?
Thanks a lot Amiram. Exactly what I was looking for.
By "overriden properties" I meant the "Override" object. Sorry for the confusion. Following your answer for accessing bands, I can see the same can be used to access Override.
Mike Saltzman said: If you are going to set the hidden property on a column to true, I recommend that you do it in the InitializeLayout event. You can do it anywhere, but this is a good event to use because it fires when the grid's datasource is set.The event is specifically designed for setting up the layout of the grid including (among other things), the visibility of columns. You will probably also want to use the ExcludeFromColumnChooser property on the column to prevent the column from displaying in the ColumnChooser.
If you are going to set the hidden property on a column to true, I recommend that you do it in the InitializeLayout event. You can do it anywhere, but this is a good event to use because it fires when the grid's datasource is set.The event is specifically designed for setting up the layout of the grid including (among other things), the visibility of columns.
You will probably also want to use the ExcludeFromColumnChooser property on the column to prevent the column from displaying in the ColumnChooser.
Thanks a bunch to you too Mike. Yes I do intend to use the initializelayoutevent. Although there will be more to it. I am actually extending the UltraGrid to simulate some properties and events and posibly methods of the DataGridView. I have a huge project and I really really want to use UltraGrid. But the project has a DataGridView on almost every section. If I directly substitute the two controls, I'll have to do a LOT of work to also update the handler sections and what not. Hence my idea of doing it this way.
Thanks to both of you. This is an excellent community :)
Oh and thanks to you too morrisd. Your code gave me a few hints of what I might need to do for something else.