Hi,
I have an UltraGrid bound to a DataSet. There is an InitializeRow event which initializes the grid rows with some check boxes. Now when i change the value of a cell in code then the event gets fired again. This is odd as the event is supposed to fire when data is bound. This is causing big performance issues as i loop and change value of some cells in all rows in the grid (some 3000 rows). Is there a way to ensure this event fires only when the grid's datasource is set and not for every cell data change in code?
Cheers,
SK
Only do your code if e.reinitialize is false.
Nick
Currently i am doing it like that. But that still does not help performance as the event fires but does nothing. What i wanted to know is, is there any property which is ensure this event fires only when the gird is data bound, otherwise it makes no sense. Why should the event fire when i change data of a cell in my code?
I tried disabling the event but it did not help improve the performance. I have tried everything you have mentioned in the WinGrid Performance Guide. The only thing that is different is that i have an unbound check box column when it works but when i use a bound check box column it takes ages. The trouble is if i add an unbound column and then set the source of grid then in initializerow event i do not get this column in e.Row so i can not set its value. Any pointers on how to do this?
ugrid.EventManager.SetEnabled(GridEventIds.InitializeRow, false);
the event still fires when i set
ultragridrow.Expanded = true;
If you have disabled the event and it's still firing for any reason, then that is clearly a bug and you should Submit an incident to Infragistics Developer Support.
The thing is the event fires after i set the row.Expanded = true; so if i disable event before this and enable it after this statment the event fires. Here is my code:
{
ugrid.BeginUpdate();
ugrid.SuspendRowSynchronization();
try
row.Expanded = expcollflag;
crow.Expanded = expcollflag;
}
finally
ugrid.ResumeRowSynchronization();
ugrid.EndUpdate();
ugrid.EventManager.SetEnabled(GridEventIds.InitializeRow, true);
I was able to disbale the event finally by placing a disable statement just after the for loop exits. But it does not solve the performance problem. I have another project in which i do not have this initializerow event and the same code executes in a zap.
What is could be causing this? This is giving me nightmares :-(
Another funny thing is that it runs slowly only for the first time. I.e.Once all rows are expanded subsequent calls to collapse and expand take no time to execute. What is going on here?
It might have saved me some time.
Hm, I guess I must have missed it when you asked how to do that. In any case, there is no automatic conversion, you simply have to loop through the rows and copy the data.
I have used UltraDataSource and converted my Dataset to UltraDataSource. What i really wanted was a sample on how to convert Dataset to UltraDataSource. But i had to do it all myself. This was a bit disappointing after having paid for almost 10 developer licenses for Infragistics.
contactkalim said:What iam doing is that i have a dataset in which i have 2 datatables which have a parent child relationship. This is bound to the UltraGrid. Now I needed a check box and and image column at level 1 rows and disbale level 2 rows. So i was looping through all rows in the Grid to do this. This was making the grid load very slowly. Then i felt may be i should use Initialize row event. That seemed to have fixed the loading problem.
Okay, that makes sense.
contactkalim said:So i thought may be its the problem of the InitializeRow event. But that is not the case as per you and the forum its the datasource which is a Dataset which is slow when fetching child rows. So please suggest me a datasource which serves my purpose otherwise please tell me why should i pay licence fee for this grid. What i wanted to know is how i can use some other datasource in the present condition? I have a Dataset so definetly i should be able to convert this into some other datasource for which the Grid gives me the functionality our users want. Please advice.
Okay. I very much doubt that the InitializeRow event has anything to do with this. As I said, the DataSet tends to be pretty inefficient when you retrieve child rows. This has nothing to do with the grid, and you would experience the same issue with any control that displays hierarchical data.
I don't know of any other data sources that retrieve data from a database, but if you want to use a data source that is more efficient, then you could use the UltraDataSource component. Of course, you would have to load all of the data into this control up front, so that would cause a performance hit. Perhaps there are other, 3rd-party data sources out there that are more efficient than the DataSet.
You might try creating a BindingSource and setting it's datasource to your dataset. Then setting the grid datasource to the bindingsource.
There was a performance problem associated with parent child relationships caused by Microsoft when (VS 2005 came out) I believe.