BaseDataBoundControl.ValidateDataSource(Object) 方法

定義

在衍生類別中覆寫時,驗證資料繫結控制項繫結的物件是它可以使用的物件。When overridden in a derived class, verifies that the object a data-bound control binds to is one it can work with.

protected:
 abstract void ValidateDataSource(System::Object ^ dataSource);
protected abstract void ValidateDataSource (object dataSource);
abstract member ValidateDataSource : obj -> unit
Protected MustOverride Sub ValidateDataSource (dataSource As Object)

參數

dataSource
Object

要驗證的物件。The object to verify. 通常是 IEnumerableIListSourceIDataSourceIHierarchicalDataSource 的執行個體。Typically an instance of IEnumerable, IListSource, IDataSource, or IHierarchicalDataSource.

給實施者的注意事項

ValidateDataSource(Object)方法只會在 BaseDataBoundControl 類別的 (setter) 屬性中呼叫 DataSourceThe ValidateDataSource(Object) method is only called in the BaseDataBoundControl class's mutator (setter) for the DataSource property. 衍生類別會執行方法來檢查為屬性設定的物件類型 DataSource ,以確保資料繫結控制項可以使用此類型。Derived classes implement the method to check the type of the object that is set for the DataSource property, to ensure that the data-bound control can work with the type. 如果無法辨識型別,衍生型別會擲回例外狀況。If the type is not recognized, derived type implementations throw an exception.

適用於