IStateManager.LoadViewState(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當由類別實作時,會將伺服器控制項先前儲存的檢視狀態載入到控制項中。
public:
void LoadViewState(System::Object ^ state);
public void LoadViewState(object state);
abstract member LoadViewState : obj -> unit
Public Sub LoadViewState (state As Object)
參數
範例
// 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 基礎架構,並非直接從程式碼中使用。 然而,控制項開發者可以覆寫此方法,以指定自訂伺服器控制項如何恢復其檢視狀態。 欲了解更多資訊,請參閱 ASP.NET 州管理概述。