2013-02-20 58 views
0

如何绑定细节视图并返回类对象?使用类对象绑定详细信息视图

Dim _obj As New NewRequestDetailsBL 

_obj = NewRequestDetailsBL.SelectRequestDetails(Session("requestid"), 
Session("contactid")) 
dvAdmin1.DataSource = _obj ' this line is giving the error 
dvAdmin1.DataBind() 

错误:

System.InvalidOperationException: Data source is an invalid type. 
It must be either an IListSource, IEnumerable, or IDataSource. 

回答

1

错误包含所有你需要的信息!

It must be either an IListSource , IEnumerable , or IDataSource .

你的类必须实现这些接口中的至少一个,然后你就可以设置DataSourceNewRequestDetailsBL类的一个实例。