We recently upgraded our .Net 1 application to the latest NetAdvantage controls (2007 Vol 1 CLR 1) from a previous version (2006 Vol 6 CLR 1 - I think).
I've encountered a problem with one of our grids. We have several functions that fire off the InitializeRow event on the grid, which is bound to a Dataset. When certain criteria are met, the DS is cleared and refilled, and so the grid repopulates, and the expected behaviour is that the IR event should fire as each of the new rows are added.
In reality, whilst the first population works fine, any subsequent repopulations fail to fire the IR event, and as such as not formatted/hidden as required.
I tried saving the grid layout, deleting the grid, and creating a new grid to import the layout into, but the problem remained. However, I managed to figure out that its something in the layout file thats causing the problem. If i add a grid to the form, and dont import the layout, the grid performs as expected.
For this particular case, I have just bitten the bullet and rebuilt the grid by hand (including reattaching all the handlers), but ideally I'd like clarification on the cause of this issue, so that if it arises in future, I can resolve it without having to delete and recreate the grid by hand.
Can anyone shed light on this?
Thanks
Fergal
Hello Fergal,
When the UltraGrid gets a reset notification, it checks the new rows and compares them to the existing rows. If it finds that these are the same objects in the same order, then there's no reason for the grid to throw everything away, which would lose state information and fire InitializeRow.
If you want to manually force the InitializeRow event to be fired you could set the DataSource property of the grid to null and the to the DataSet you use. Another approach might be using the following:
grid.Rows.Refresh(FireInitializeRow);
Please do not hesitate to ask if something comes up.