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.Gets a value indicating whether the current server control's child controls have any saved view-state settings.
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
.true
if any child controls have saved view state information; otherwise, 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 el uso de esta propiedad para comprobar que todos los controles secundarios del control de servidor almacenan información de estado de vista.You can avoid unnecessary calls to the ClearChildViewState method by using this property to verify that any child controls of the server control are storing view-state information.