我想判断一个类是否具有DataSource属性,然后对其赋值,下面有一段代码,不太明白
private void BoundControl_DataBound(object sender,System.EventArgs e)
{
if (HasParentControlCalledDataBinding) return;
Type type = sender.GetType();
_datasource = type.GetProperty("DataSource");
if (_datasource == null)
throw new NotSupportedException("分页控件要求表现控件必需包含一个DataSource。");
object data = _datasource.GetGetMethod().Invoke(sender,null);
_builder = Adapters[data.GetType()];
if (_builder == null)
throw new NullReferenceException("没有安装适当的适配器来处理下面的数据源类型:"+data.GetType());
_builder.Source = data;
}
_builder这个是什么类型?我仅仅需要对DataSource赋值即可
全文http://www.6to23.com/s11/s11d8/s11d8d1/2004421154352.htm