HierarchicalDataBoundControl.ValidateDataSource(Object) 方法

定義

驗證資料繫結控制項繫結至的物件是該資料繫結控制項所使用的物件。Verifies that the object a data-bound control binds to is one it can work with.

protected:
 override void ValidateDataSource(System::Object ^ dataSource);
protected override void ValidateDataSource (object dataSource);
override this.ValidateDataSource : obj -> unit
Protected Overrides Sub ValidateDataSource (dataSource As Object)

參數

dataSource
Object

物件,設為 DataSource 屬性。An object set to the DataSource property.

例外狀況

dataSource 不是 null,而且不會實作 IHierarchicalEnumerableIHierarchicalDataSource 介面。dataSource is not null and implements neither the IHierarchicalEnumerable nor the IHierarchicalDataSource interface.

備註

ValidateDataSource方法只會在 BaseDataBoundControl 類別的 (setter) 屬性中呼叫 DataSourceThe ValidateDataSource method is called only in the BaseDataBoundControl class's mutator (setter) for the DataSource property. HierarchicalDataBoundControl類別會檢查為屬性設定的物件類型, DataSource 以確保它是 IHierarchicalEnumerable 或介面的實例 IHierarchicalDataSourceThe HierarchicalDataBoundControl class checks the type of the object that is set for the DataSource property to ensure that it is an instance of the IHierarchicalEnumerable or IHierarchicalDataSource interfaces.

適用於

另請參閱