Yesterday I read a very good article about ViewState in ASP.NET.
We are currently using WebFormsMVP to provide the best testability in our project. The structure makes the anchor binding in OnInitComplete and relies heavily on DataBind expressions, for example.
<asp:Label Text="<%#Model.FirstName%>" runat="server" />
As I understand above, this will put Model.FirstName in the ViewState. Because data binding occurs late during the page life cycle when tracking in view mode is already enabled.
One option is to completely disable ViewState. Are there any others? Remeber, we cannot use OnInit or OnInitComplete, because OnLoad is the first event that hosts can handle.
Also keep in mind that I used the shortcut as an example. I am looking for a solution that will also work for complex controls.
Thank.
source
share