Page.RegisterViewStateHandler Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Hace que el estado de la vista de página se conserve, si se llama a .
public:
void RegisterViewStateHandler();
public void RegisterViewStateHandler();
member this.RegisterViewStateHandler : unit -> unit
Public Sub RegisterViewStateHandler ()
Ejemplos
// 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
Comentarios
El RegisterViewStateHandler método se llama automáticamente a través del control de HtmlForm servidor. Si no se invoca este método, no se conservará el estado de la vista de página.
Note
Normalmente, solo el control de HtmlForm servidor de la página llama a este método.