BaseDataBoundControl.IsBoundUsingDataSourceID 속성

정의

DataSourceID 속성이 설정되었는지 여부를 나타내는 값을 가져옵니다.

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

속성 값

true 경우 반환 되는 DataSourceID 속성이 아닌 다른 값으로 설정 됩니다 Empty이 고, 그렇지 않으면 값은 false합니다.

예제

다음 코드 예제에서는 방법을 IsBoundUsingDataSourceID 속성은 데이터 바인딩된 컨트롤을 파생된 클래스에서 사용 됩니다. IsBoundUsingDataSourceID 속성은 사용 합니다 PerformSelect 메서드 구현이 결정 여부를 DataBinding 이벤트를 발생 시켜야 합니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 DataBoundControl 클래스입니다.

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

설명

와 같은 컨트롤 GridView, DetailsViewFormView, 및 Menu 사용 합니다 IsBoundUsingDataSourceID 속성 데이터 바인딩된 컨트롤을 ASP.NET 2.0 데이터 소스 컨트롤에 같은 바인딩 되었는지 여부를 확인 하는 ObjectDataSource 또는 SqlDataSource .

적용 대상

추가 정보