Page.RegisterViewStateHandler 메서드

정의

호출 하면 페이지 뷰 상태가 유지 됩니다.Causes page view state to be persisted, if called.

public:
 void RegisterViewStateHandler();
public void RegisterViewStateHandler ();
member this.RegisterViewStateHandler : unit -> unit
Public Sub RegisterViewStateHandler ()

예제

// Create a custom HtmlForm server control named MyForm. 
public class MyForm : HtmlForm
{
   // MyForm inherits all the base funcitionality
   // of the HtmlForm control.
   public MyForm():base()
   {
   }
   // Override the OnInit method that MyForm inherited from HtmlForm.
   
   [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
   protected override void OnInit( EventArgs e)
   {
      // Save the view state if there are server controls on
      // a page that calls MyForm.
      Page.RegisterViewStateHandler();
   }
}
' Create a custom HtmlForm server control named MyForm.
Public Class MyForm
   Inherits HtmlForm
   
   ' MyForm inherits all the base funcitionality
   ' of the HtmlForm control.
   Public Sub New()
   End Sub
   
   ' Override the OnInit method that MyForm inherited from HtmlForm.
   <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
   Protected Overrides Sub OnInit(e As EventArgs)
      ' Save the view state if there are server controls on
      ' a page that calls MyForm.
      Page.RegisterViewStateHandler()
   End Sub
End Class

설명

RegisterViewStateHandler 메서드는 HtmlForm 서버 컨트롤을 통해 자동으로 호출 됩니다.The RegisterViewStateHandler method is automatically called through the HtmlForm server control. 이 메서드는 호출 하지 않으면, 페이지 뷰 상태 유지 되지 않습니다.If this method is not invoked, the page view state will not be persisted.

참고

일반적으로 페이지에 대 한 HtmlForm 서버 컨트롤은이 메서드를 호출 합니다.Typically, only the HtmlForm server control for the page calls this method.

적용 대상

추가 정보