BaseDataBoundControl.IsBoundUsingDataSourceID Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Recebe um valor que indica se a DataSourceID propriedade está definida.
protected:
property bool IsBoundUsingDataSourceID { bool get(); };
protected bool IsBoundUsingDataSourceID { get; }
member this.IsBoundUsingDataSourceID : bool
Protected ReadOnly Property IsBoundUsingDataSourceID As Boolean
Valor de Propriedade
O valor true é devolvido se a DataSourceID propriedade for definida para um valor diferente de Empty; caso contrário, o valor é false.
Exemplos
O exemplo de código seguinte demonstra como a IsBoundUsingDataSourceID propriedade é usada por uma classe de controlo derivada baseada em dados. A IsBoundUsingDataSourceID propriedade é usada na PerformSelect implementação do método para determinar se o DataBinding evento deve ser levantado. Este exemplo de código faz parte de um exemplo maior fornecido para a DataBoundControl classe.
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
Observações
Controlos como GridView, DetailsView, FormView e Menu utilizam a propriedade IsBoundUsingDataSourceID para determinar se o controlo ligado a dados está ligado a um controlo de fonte de dados ASP.NET 2.0, como um ObjectDataSource ou SqlDataSource.