Problem keeping total of child list amounts

Problem keeping total of child list amounts

Old forum URL: forums.lhotka.net/forums/t/2863.aspx


mikeclimbs posted on Monday, May 14, 2007

I have a Editable Root Parent(TransactionHeader) with a Child List(TransactionDetails) that contains an amount field( Debit ).  Also I have a Calculated Property in the parent TotalDebits.  TotalDebits is updated using the ListChanged event.  The TotalDebits field is used for validation and is also bound to a label in the UI

Editing of the child is done via a grid

The issue is everytime the TotalDebits property is updated by the ListChanged event the grid refreshes and sets focus back to the first row.

Is there a better way to handle totaling the child list.

I'm using  Csla 2.14 and VB

Thanks

Mike

 

 

RockfordLhotka replied on Monday, May 14, 2007

If I understand correctly, your root object handles ListChanged and loops through the children to re-total the value, then raises its own PropertyChanged to indicate that the total value is updated?

I do this sort of thing all the time without such an issue.

Something at the UI level is grabbing focus. Objects and events can't alter focus - it is almost certainly code in your UI that is the issue.

Do you have any UI code to handle ListChanged or PropertyChanged? Do you have any code handling a changed (or other) event for that textbox? Or any other control outside the grid?

mikeclimbs replied on Monday, May 14, 2007

Rocky,

Thanks for the help,  I'll review my UI for the culprit

Thanks

Mike

 

mikeclimbs replied on Monday, May 14, 2007

Rocky,

As usual you were right.  My UI was the issue.

I'm using a devexpress grid and they have a property KeepFocusedRowOnUpdate that defaults to true.  When true it moves focus off new rows on update.  Changing it to false solved my issue.

Thanks

Mike

Copyright (c) Marimer LLC