Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
When does Entity get updated?
Message
De
28/07/2010 12:01:23
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
28/07/2010 09:40:14
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01474174
Message ID:
01474299
Vues:
31
>Hi Tim,
>
>>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.
>>
>
>What "save" do you mean? I have a Save button which saves the entity back to the database, but I don't want this done until the user actually presses the Save button.
>
>I also don't understand what you mean by "the event is raised". Could you explain that, please?
>
>>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
>
>What are the couple different ways that I can approach this?


When you click a save button and call a method to save data, MM business objects will raise a saving event. The bound controls respond to that event and update their values back into the entities.
Basically if you want to do something with those values before the save is called you need to reference what is in the textbox and not what is in the entity since it has been changed and not saved back. This is true for both cases you listed. In the second case above, save the new value into the textbox for the user to see then when the save is called that value will be automatically saved back to the entity.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform