DataBoundControl.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,也不是可以识别的类型。The object passed by the dataSource parameter is not null or a recognized type.

注解

仅在类的DataSource属性的赋值函数 (set访问器) 中调用方法。ValidateDataSource BaseDataBoundControlThe ValidateDataSource method is only called in the BaseDataBoundControl class's mutator (set accessor) for the DataSource property. DataSource IDataSource IListSource类检查为属性设置的对象的类型, 以确保它是、或IEnumerable接口的实例。 DataBoundControlThe DataBoundControl class checks the type of the object that is set for the DataSource property to ensure that it is an instance of the IDataSource, IListSource, or IEnumerable interface.

适用于

另请参阅