Why is it advisable to store viewstate values ​​in a PreRender event call?

I'm trying to save member variables by storing them in ViewState (only a few small variables), but I read, and I'm going to better save them in ViewState at the PreRender stage than on the Load page?

I see that the ViewState can be saved at any time before rendering the page, but does it matter in PreRender or PageLoad?

+3
source share
1 answer

No, there is no difference. You just need to save the variables in the ViewState after you change them. Do not save the variable in ViewState in the Page_Load event if you change it again in PreRender.

+4
source

Source: https://habr.com/ru/post/1716514/


All Articles