Prev | Current Page 163 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

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.
Another improvement in ASP.NET 2.0 and later is control state, which allows a control to
store important control-related data items required for proper function even if ViewState is
disabled. We cover control state in more detail later in this chapter.
The StateBag Class and the IStateManager Interface
The client-side state management technique ViewState exists in the .NET Framework class
hierarchy as a member property of the System.Web.UI.Control class called ViewState, of type
StateBag, which implements a dictionary data structure to store name/value pairs. The StateBag
class implements the interfaces in Table 3-3.


Pages:
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175