The Web Pages in EP 4.0 are stateless. On every roundtrip to the server, they are instantiated, processed, rendered, and disposed. In ASP.NET , if the page needs to keep it’s state between server roundtrips , when a server side event is processed , ASP.NET page framework uses a hidden input control referred as ViewState to store the state of the page and all the controls in that page in encoded format to persist between web requests. The EP Web framework persist the value of the Web controls in ASP.NET ViewState during page postback No custom coding by developers is required to persit the Web Control values between postbacks. However the developers need to take care of storing any information other than the Web control values such as values stored in variables into ViewState.
The EP Web framework provides several events that allow you to persist the values of variables and temporary tables into the ViewState during postbacks in Web forms in X++. . The first such event is called the loadViewState event. You can use this event to load the in-memory variables from the ViewState. The loadViewState event occurs before the init and run events are executed.The second event to occur that is related to ViewState is the loaded event. By this time, the changes to the data source and Web controls have been applied, the controls on the Web page have been updated with postback data, and the ViewState of the page has been updated with postback data. This is the right place to use the in-memory variables retrieved from the ViewState and subsequently update the Web controls, if necessary.The third event related to ViewState is called saveViewState. This event can be used to save the in-memory variable into the ViewState. The SaveViewState event occurs after the layout event.