ViewState
As mentioned in the previous section, the ViewState server control state management technique
builds on the hidden form field client-side method, taking advantage of its well documented
benefits while minimizing its potential drawbacks. ViewState addresses hidden form variable
limitations by providing built-in data management, compression, encoding, and tamper resistance,
so web developers and control builders can focus on the application requirements and
business logic.
In ASP.NET 2.0 and later, ViewState is greatly improved compared to .NET Framework 1.1
or earlier by a reduction in encoding size, which reduces the size of pages with ViewState enabled.
Also, ViewState in ASP.NET 2.0 and later does a much better job of integrating with data controls
like GridView by intelligently using ViewState when data controls are bound to declarative data
source controls—meaning, if ViewState is enabled, ASP.NET 2.0 and later will not go back to
the database to get data. However, if ViewState is disabled, ASP.NET 2.0 and later will automatically
go back and bind to the data source. This functionality is building into the
DataBoundControl base class.
As mentioned in the previous section, the ViewState server control state management technique
builds on the hidden form field client-side method, taking advantage of its well documented
benefits while minimizing its potential drawbacks. ViewState addresses hidden form variable
limitations by providing built-in data management, compression, encoding, and tamper resistance,
so web developers and control builders can focus on the application requirements and
business logic.
In ASP.NET 2.0 and later, ViewState is greatly improved compared to .NET Framework 1.1
or earlier by a reduction in encoding size, which reduces the size of pages with ViewState enabled.
Also, ViewState in ASP.NET 2.0 and later does a much better job of integrating with data controls
like GridView by intelligently using ViewState when data controls are bound to declarative data
source controls—meaning, if ViewState is enabled, ASP.NET 2.0 and later will not go back to
the database to get data. However, if ViewState is disabled, ASP.NET 2.0 and later will automatically
go back and bind to the data source. This functionality is building into the
DataBoundControl base class.
Tags:
asp.net