Ce sujet n'a pas encore été évalué - Évaluez ce sujet

Control.HasChildViewState, propriété

Obtient une valeur indiquant si les contrôles enfants du contrôle serveur en cours possèdent des paramètres d'état d'affichage enregistrés.

Espace de noms : System.Web.UI
Assembly : System.Web (dans system.web.dll)

protected bool HasChildViewState { get; }
/** @property */
protected boolean get_HasChildViewState ()

protected function get HasChildViewState () : boolean

Valeur de la propriété

true si des contrôles enfants possèdent des informations d'état d'affichage enregistrées ; sinon, false.

Vous pouvez éviter tout appel superflu à la méthode ClearChildViewState en utilisant cette propriété pour vérifier que des contrôles enfants du contrôle serveur stockent des informations d'état d'affichage.

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 void DataBind()
{
    super.OnDataBinding(EventArgs.Empty);

    // Reset the control's state.
    get_Controls().Clear();

    // Check for HasChildViewState to avoid unnecessary calls to 
    // ClearChildViewState.
    if (get_HasChildViewState()) {
        ClearChildViewState();
    }
    set_ChildControlsCreated(true);
    if (!(get_IsTrackingViewState())) {
        TrackViewState();
    }
} //DataBind

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition

Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.

.NET Framework

Prise en charge dans : 2.0, 1.1, 1.0
Cela vous a-t-il été utile ?
(1500 caractères restants)

Ajouts de la communauté

AJOUTER
© 2013 Microsoft. Tous droits réservés.