Hello,
on a button click, users can add (or remove) additional columns to the grid. This new columns should be fixed left after one fixed column that is always present.
What is the best approach to achieve this? Adding the column to the ultraDataSource? Which event of the grid reflect this change?
Thanks for any help. Markus
Hi,
There's a property on the InitializeRow event args called ReInitialize. This tells you whether the row is being initialized for the first time or not. But I don't think that will help you in this case.
There is no other information about why the row is being initialized.
If you are concerned about making your InitializeRow code as efficient as possibly, check out the WinGrid Performance Guide.
Hi Mike,
Adding a unbound column fires the Initialize_row event. Do I have any possibility to check the reason within this event? If I know the reason (adding a new column of a certain type), I just can make settings for the new column to be more efficient since I can have lots of columns and rows?
Markus
As long as the grid is bound to a data source that has at least once field, then you can add as much unbound columns as you want and the grid will store that data for you for the life of the application.
The InitializeRow event is usually a good place to populate your unbound cells with data.
the column don't need to be bound. The column contains some read only information showed to the users and should be enabled / disabled at request.
Adding this column(s) directly to the grid seems a good solution for me. I did not realized this possibility.
Thanks for your help.
Do the additional columns need to be bound? In other words, do you need these columns to exist in the data source? Or do you want them to exist as unbound columns in the grid?
You can do it either way. The Band object on either the grid or the UltraDataSource has a Columns collection which supports an Add method. So which one you use is up to you.
No event will fire when you add a column to the grid or the UltraDataSource - or at least no event specific to this operation. You really don't need an event here, since it's your code that is making the change.