Control.HasChildViewState Propiedad

Definición

Obtiene un valor que indica si los controles secundarios del control de servidor actual tienen guardada alguna configuración del estado de vista.

protected:
 property bool HasChildViewState { bool get(); };
protected bool HasChildViewState { get; }
member this.HasChildViewState : bool
Protected ReadOnly Property HasChildViewState As Boolean

Valor de propiedad

Es true si alguno de los controles secundarios tiene guardada información sobre el estado de vista; en caso contrario, es false.

Ejemplos

public override void DataBind() 
{
   base.OnDataBinding(EventArgs.Empty);
   // Reset the control's state.
   Controls.Clear();
   // Check for HasChildViewState to avoid unnecessary calls to ClearChildViewState.
   if (HasChildViewState)
      ClearChildViewState();
   ChildControlsCreated = true;
   if (!IsTrackingViewState)
      TrackViewState();
}
Public Overrides Sub DataBind()
   MyBase.OnDataBinding(EventArgs.Empty)
   ' Reset the control's state.
   Controls.Clear()
   ' Check for HasChildViewState to avoid unnecessary calls to ClearChildViewState.
   If HasChildViewState Then
      ClearChildViewState()
   End If
   ChildControlsCreated = True
   If Not IsTrackingViewState Then
      TrackViewState()
   End If
End Sub

Comentarios

Puede evitar llamadas innecesarias al ClearChildViewState método mediante esta propiedad para comprobar que los controles secundarios del control de servidor almacenan información de estado de vista.

Se aplica a

Consulte también