By Leonard P. - 9/25/2008
Hello,
I am having a serious issue with BO state: When Bo.Save is executed, it fires IsDirtyChanged event, and it looks like position moves to the first row. I have a breakpoint in Navigated and IsDirtyChanged, even though it does not stop on the breakpoint in Navigated, it does stop in IsDirtyChanged, and when I output ?bo.CurrentRowIndex in immediate window it says "0" which is not the same position when .Save was called. What's going on?
Thanks.
|
By Dustin Taylor - 9/26/2008
Well, there are a couple points here.
1) The IsDirtyChanged event will only be fired after saving for those rows that were dirty. This makes sense if you think about it. The IsDrityChanged event gets fired whenever a "clean" row becomes dirty or when a "dirty" row becomes clean. So if you aren't managing UI states automatically, and just start typing into a field bound to a populated BO, it will fire the IsDirtyChanged event. In the same token, if you go to save that row, the IsDirtyChanged event will be fired after the save since the row state is no longer dirty.
2) The Navigated event will not be fired during a save. The difference between "Navigate" and "Move" is that a navigate will update the bound controls. Since the save just iterates through the records in the BO so that it can CheckRulesOnCurrentRow it does not need to update the UI, and as such is performing a move, which will not fire the Navigated event.
So, it will iterate through your BO on a save and try to save any dirty records. The CurrentRowIndex will change in the middle of that iteration to reflect the movement through the BO, but once it is finished it will be restored to it's original position.
|
|