Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
When does Entity get updated?
Message
From
28/07/2010 09:24:06
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
27/07/2010 21:01:13
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01474174
Message ID:
01474268
Views:
29
Hi Frank,

>Hi Tim,
>
>just to make sure you understand what I am trying to do:
>
>As the user changes the Sum Assured value, I need to calculate and display the Premium. So in the SumAssured_TextChanged, I passed the oPolicy.Entity.SumAssured value to my oPolicy.CalculatePremium() and assign the return value to the oPolicy.Entity.Premium, but the SumAssured value was the old value, not the newly entered value. Also the correct return value is being put in the Entity.Premium, but when the page loads again the old premium value is back there.
>
>My technique with the DataSet is working (calculations and save work fine), but it just feels like I am not doing the right thing. How should one approach this?

OK, now I understand better. If the user changes the sumAssured value in a textbox that is bound, it will not be bound back to the entity until a save occurs or the event is raised. What you could do, is either manually save it back first or just use the value from the textbox to pass into the CalculatePremium method. Later when the save occurs it would save that value back to the entity.

You have a similar situation with the Entity.Premium where you have a value in the textbox and you are changing it in the entity. Then when the postback occurs, the value is being re-bound to the old value. This is all about timing really and you could approach this a couple of different ways. If you change the value in the textbox and you will ultimately do a save, then the value would be bound back during the save just fine.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform