Business Object Lost on Postback

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
6/16/2011 9:24:02 AM
Gravatar
Total Posts 88

Business Object Lost on Postback

Hi,

In my solution i create a new webpage with mojoBasePage dependency  and when the page_load i create some businessObject but when i Post_back the page i´ve lost all of this objects.

i´ve tried the AutoEventWireup="false" and Page.EnableViewState = true; or //this.EnableViewState = true;

but i can stay this object alive, why?

I´m searching where but i can find a solution.

Thanks

6/17/2011 1:08:29 PM
Gravatar
Total Posts 18439

Re: Business Object Lost on Postback

Web programming is a stateless request response environment, postback is a new request nothing remains from the previous request unless you have it stored in session variables or viewstate, but viewstate is really for control state not for business objects. You would need to re-create the business object on each request, or if it is very expensive to create the object you could persist it in session state or cache but I would not go wild with session state and only use it if you really really need it because it uses server memory which is a precious resource and often the most precious resource.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.