Page.RegisterViewStateHandler Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Faz com que o estado de visualização da página seja mantido, se for chamado.
public:
void RegisterViewStateHandler();
public void RegisterViewStateHandler();
member this.RegisterViewStateHandler : unit -> unit
Public Sub RegisterViewStateHandler ()
Exemplos
// 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
Observações
O RegisterViewStateHandler método é automaticamente chamado através do controlo do HtmlForm servidor. Se este método não for invocado, o estado de visualização de página não será mantido.
Note
Normalmente, apenas o controlo do HtmlForm servidor para a página chama este método.