Export (0) Print
Expand All

Control.LoadViewStateByID Property

Gets a value indicating whether the control participates in loading its view state by ID instead of index.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

protected bool LoadViewStateByID { get; }

Property Value

Type: System.Boolean
true if the control loads its view state by ID; otherwise, false. The default value is false.

By default, when a parent control loads view state into child controls it creates, it does this by the position of each child control in the parent control's Controls collection. When view state is initially applied, all child controls might not have been created. In this case, the view state for controls not yet created is saved, and applied when the child controls are created later.

For a parent control to apply view state to its child controls, two conditions must be met:

  • On postback, the parent control must create the child controls in exactly the same order as the previous request so that the order of the controls remains consistent.

  • After postback, any child controls created must be added to the end of the parent control's Controls collection.

If these two conditions cannot be met, as in the case of the delayed creation of a child control, the parent control can load view state by using ID. To set the LoadViewStateByID property to true, use the ViewStateModeByIdAttribute metadata attribute for the parent control.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft