Hello,
I'm using a WinGrid with unbound columns that may be added at runtime. These column data values are not IConvertible to strings. I use the InitializeRow event to populate the unbound column. Also, I'm using LoadOnDemand so not all rows are initialized.
I am getting an exception based on the order of events:
1) Add / Insert column - seems it has to be a new column with default DataType Text.
2) This immediately triggers the Initialize Row event which tries to populate the cell.Value and throws an exception based on Value type is not IConvertible.
3) Then run the configure code that sets the column dataType and other parameters (I'm actually using a DropDown with a ValueList to show icons reflecting object types).
Is there any way to configure a column and then add it to the WinGrid? Or is there any way to defer the InitializeRow event til after the column has been configured (SuspendRowSynchronization doesn't seem to delay these events)? Or is there a way to trigger the InitializeRowEvent again after configuration but only for the rows already initialized?
Thanks for any suggestions.
Wendy
Hi,
You can generally suspend events using the EventManager eg.
YourGrid.EventManager.IsEnabled(GridEventIds.InitializeRow, false);
You can also trigger InitilizeRow by calling:
YourGrid.Rows.Refresh(RefreshRow.FireInitializeRow, true);
Ryan
Sorry that should read - YourGrid.EventManager.SetEnabled.(GridEventIds.InitializeRow, false)
Sorry that should read - YourGrid.EventManager.SetEnabled(GridEventIds, false)