How to make collection as IsDirty

How to make collection as IsDirty

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


vijay posted on Thursday, July 17, 2008

I have following BOs for my screen, that gets values from table and shows that into grid control, say for a Country.

1. Editable Root List     2. Editable Child

If there are no records for the Country in table, say t_country, we show default values in Grid. Now i need to save values in table when user clicks on Save button. The problem here is if user does not change any value in grid, IsDirty is not set as True for any of the Object so it will not go to DataPortal_Update of collection object Editable Root List. But i need to insert values in table t_country here. How can i set IsDirty peroperty as True for any of the Object.

Thanks

RikGarner replied on Thursday, July 17, 2008

If there are no values in the database when you fetch you could add a child object with the default values to the list. That way the list will be dirty when you come to save.

Alternatively, when the Save button is pressed, you could first check if the list is really empty and if so, add a child object to it before persisting it.

 

Copyright (c) Marimer LLC