DataBoundControl.MarkAsDataBound DataBoundControl.MarkAsDataBound DataBoundControl.MarkAsDataBound DataBoundControl.MarkAsDataBound Method

Definición

Establece el estado del control en estado de vista como enlazado correctamente a los datos.Sets the state of the control in view state as successfully bound to data.

protected:
 void MarkAsDataBound();
protected void MarkAsDataBound ();
member this.MarkAsDataBound : unit -> unit
Protected Sub MarkAsDataBound ()

Ejemplos

En el ejemplo de código siguiente se MarkAsDataBound muestra cómo se utiliza el método en una clase de control enlazado a datos derivada.The following code example demonstrates how the MarkAsDataBound method is used by a derived data-bound control class. GetData Una vez que el método recupera los datos y se enlazan al control con el PerformDataBinding método RequiresDataBinding , la propiedad se false establece en MarkAsDataBound y se llama al método para indicar que el control ha completado el enlace y ya no lo requiere durante el ciclo de vida de la página actual.After data is retrieved by the GetData method and bound to the control with the PerformDataBinding method, the RequiresDataBinding property is set to false and the MarkAsDataBound method is called to signal that the control has completed binding and no longer requires it during the current page's life cycle. Este ejemplo de código forma parte de un ejemplo más extenso proporcionado DataBoundControl para la clase.This code example is part of a larger example provided for the DataBoundControl class.

protected override void PerformSelect() {            

   // Call OnDataBinding here if bound to a data source using the
   // DataSource property (instead of a DataSourceID), because the
   // databinding statement is evaluated before the call to GetData.       
    if (! IsBoundUsingDataSourceID) {
        OnDataBinding(EventArgs.Empty);
    }            
    
    // The GetData method retrieves the DataSourceView object from  
    // the IDataSource associated with the data-bound control.            
    GetData().Select(CreateDataSourceSelectArguments(), 
        OnDataSourceViewSelectCallback);
    
    // The PerformDataBinding method has completed.
    RequiresDataBinding = false;
    MarkAsDataBound();
    
    // Raise the DataBound event.
    OnDataBound(EventArgs.Empty);
}
Protected Overrides Sub PerformSelect()

    ' Call OnDataBinding here if bound to a data source using the 
    ' DataSource property (instead of a DataSourceID) because the 
    ' data-binding statement is evaluated before the call to GetData.
    If Not IsBoundUsingDataSourceID Then
        OnDataBinding(EventArgs.Empty)
    End If

    ' The GetData method retrieves the DataSourceView object from the 
    ' IDataSource associated with the data-bound control.            
    GetData().Select(CreateDataSourceSelectArguments(), _
        AddressOf OnDataSourceViewSelectCallback)

    ' The PerformDataBinding method has completed.
    RequiresDataBinding = False
    MarkAsDataBound()

    ' Raise the DataBound event.
        OnDataBound(EventArgs.Empty)

End Sub 'PerformSelect

Comentarios

El control enlazado a datos mantiene un valor en el estado de vista que indica si está actualmente enlazado a los datos.The data-bound control maintains a value in view state that indicates whether it is currently bound to data. El MarkAsDataBound método establece el valor en true.The MarkAsDataBound method sets the value to true.

Se aplica a

Consulte también: