BaseDataBoundControl.IsBoundUsingDataSourceID Özellik

Tanım

Özelliğin ayarlanıp ayarlanmadığını DataSourceID belirten bir değer alır.

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

Özellik Değeri

özelliği dışında bir değere true ayarlanırsa DataSourceID değer döndürülür; aksi takdirde değer olurfalse.Empty

Örnekler

Aşağıdaki kod örneği, özelliğin IsBoundUsingDataSourceID türetilmiş bir veriye bağlı denetim sınıfı tarafından nasıl kullanıldığını gösterir. IsBoundUsingDataSourceID özelliği, olayın tetiklenip DataBinding tetiklenmemesi gerektiğini belirlemek için yöntem uygulamasında kullanılırPerformSelect. Bu kod örneği, sınıfı için DataBoundControl sağlanan daha büyük bir örneğin parçasıdır.

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

Açıklamalar

, , FormViewve Menu gibi DetailsViewGridViewdenetimler, veriye bağlı denetimin IsBoundUsingDataSourceID veya SqlDataSourcegibi ObjectDataSource bir ASP.NET 2.0 veri kaynağı denetimine bağlı olup olmadığını belirlemek için özelliğini kullanır.

Şunlara uygulanır

Ayrıca bkz.