IStateManager.LoadViewState(Object) 方法

定义

当由类实现时,将服务器控件以前保存的视图状态加载到控件。When implemented by a class, loads the server control's previously saved view state to the control.

public:
 void LoadViewState(System::Object ^ state);
public void LoadViewState (object state);
abstract member LoadViewState : obj -> unit
Public Sub LoadViewState (state As Object)

参数

state
Object

包含控件保存的视图状态值的 ObjectAn Object that contains the saved view state values for the control.

示例

// Implement the LoadViewState method. If the saved view state
// exists, the view-state value is loaded to the MyItem control. 
void IStateManager.LoadViewState(object savedState)
{
    _message = (string)_viewstate["message"];
    if (savedState != null)
        ((IStateManager)_viewstate).LoadViewState(savedState);
}
' Implement the LoadViewState method. If the saved view state
' exists, the view-state value is loaded to the MyItem 
' control. 
Sub LoadViewState(ByVal savedState As Object) Implements IStateManager.LoadViewState
    _message = CStr(_viewstate("message"))
    If Not (savedState Is Nothing) Then
        CType(_viewstate, IStateManager).LoadViewState(savedState)
    End If
End Sub

注解

此方法主要由 .NET Framework 基础结构使用,不应在代码中直接使用。This method is used primarily by the .NET Framework infrastructure and is not intended to be used directly from your code. 不过,控件开发人员可以重写此方法,以指定自定义服务器控件如何还原其视图状态。However, control developers can override this method to specify how a custom server control restores its view state. 有关详细信息,请参阅ASP.NET 状态管理概述For more information, see ASP.NET State Management Overview.

适用于

另请参阅