Hi,
I have an ultragrid with the two Bands orders and products. I have for orders around 25.000 and for products 50.000 rows which are loaded by a relation.
In my initialize row event I have the following:
if (e.Row.Band.Key == "OrderView")
{
//do some operations for every row, setting icons...
}
else if (e.Row.Band.Key == "Order_Products")
// also do some operations
Now, when I bind my grid to the datasource, the initializeRowEvent needs several minutes to loop through the data. When I reduce my child table on database to just one row, its almost fast. Does the grid here do anything in background with the data from child band or may this have something to do with the relations?
Because my application does never jump in the else if statement to work on code for the child rows. So what is the performance killer here, when the initializeRowEvent does not loop through the childs? Are there any settings on the grid tconcerning the relations?
Alex
Hi Mike,
you are right, I was accessing the child rows in initialite row event and was doing some operations on these rows. I put this in my if else statement and then its just loading when I expand my parent. So its working fine now. Thanks,
Hi Alex,
The grid doesn't create the child rows until it needs to. So InitializeRow will only fire for the root-level rows. I can't see any reason why InitializeRow should be any slower just because child rows exist in the data source.
Are you sure the problem has anything to do with InitializeRow? If you comment out your InitializeRow code, does the application load faster?
If child rows are what's causing the performance problem, then there are a few things you could look at that might give us a clue.
1) Is your code accessing those child rows in some way? Are you calling ExpandAll on the grid or setting the Expanded property on a row in code?
2) Have you change the ExpansionIndicators property. This property determines when expansion indicators are shown. By default, the grid shows expansion indicators on every row and only checks to see if there are any actual child rows when someone expands a row. The reason it defaults this way is becuase when using a DataSet determining the count of child rows for any particular parent row can be a very expensive operation performance-wise. So if you set ExpansionIndicators to CheckOnDisplay it would cause exactly the sort of problem you are experiencing.
3) If your data source recursive? If it's just parent and child, then that should be okay, but if your data source is recursive and could potentially have an infinite number of bands, this can sometimes cause a performance hit.
4) If none of that helps, and you haven't already done so, you might want to check out the WinGrid Performance Guide .