
672
|
Chapter 36: The System.Web.UI Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
The StateBag can contain primitive types or full-fledged serializable objects. When
retrieving an object, you will have to cast it to the correct type. Also note that you can
enumerate through the StateBag collection by using the StateItem enumerator.
Returned By
Control.ViewState, System.Web.UI.MobileControls.MobileControl.CustomAttributes, System.
Web.UI.WebControls.DataGridColumn.ViewState
Passed To
AttributeCollection.AttributeCollection( ), System.Web.UI.WebControls.Style.Style( ), System.
Web.UI.WebControls.TableItemStyle.TableItemStyle( ), System.Web.UI.WebControls.Table-
Style.TableStyle( )
StateItem
System.Web.UI (system.web.dll)
sealed class
This class represents an item in the StateBag collection and is used to track changes to
that item. The actual stored object is contained in the Value property. An additional
piece of information is provided in the IsDirty property, which is True if the item has been
changed since being saved into the StateBag collection. Changes to an item in the StateBag
are saved when the ASP.NET framework calls the Control.SaveViewState( ) method.
When you retrieve an option from the StateBag collection using the default indexer
StateBag.Item, you will receive the actual object. If, however, you want to enumerate ...