Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing values
Message
From
11/08/2010 18:44:26
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
11/08/2010 15:47:31
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Miscellaneous
Thread ID:
01476239
Message ID:
01476300
Views:
22
>>Hi Frank,
>>
>>>Hi,
>>>
>>>when does the datset get updated with the values in a textbox? I have a textbox on a web page that is bound to a BO. If I enter a value in this textbox, then click on a button that redirects to another web page which allows me to do some stuff and then the initial page gets displayed, the value from my textbox gets wiped out. If I check the Entity value just before the redirection takes place, the value is null. Likewise the datset field value is null.
>>>
>>>Is there some code that I need to call before the redirect in order to update the entity/dataset that will put all the values from all the controls into the dataset/entity?
>>
>>When you leave a web page everything goes away. The Business object and Entity you had when the page loaded was also sent to alphabet heaven as soon as the page finished loading. This is why you have to register the business objects in the page load every time. The values in the textbox are saved in a viewstate so if the page post back occurs there is still values. However if you leave the page as in a redirect everything is lost that you didn't save.
>>
>>If you need to save values but you don't want to update your database with those values, then you could save them yourself in cache or session or even a temporary table if you choose. I don't know what your requirements are but I have a situation where I have a custom class that has properties. I just save the values into those properties of the class and then save the class in the session. As the user navigates to different pages, I can retain all the selections in that class. In the end, I use those values to update the entities and save them. You could also save the business object or entity using the built in memento although I have not specifically used this feature that way.
>>Tim
>
>Hi Tim,
>

>as you can see I'm still struggling at times with this stuff :)
>
>what I don't understand is that I do this:
>
>enter a value in a textbox, then click the save button. If I stop the code running just at the point before I issue the this.Save(), the values in the dataset and entity do not reflect the values entered in the controls on the form, yet they get saved!

Hi Frank,
This is correct. What happens when you choose to save is the Business object Raises an event. The controls that are bound, will save their changed values back into the entity, then the save finishes. That is why if you just move off the form or navigate away without the save, the values will not be "bound back" to the entities.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform