【问题标题】:How to bind PprofileBase to DetailsView?如何将 PprofileBase 绑定到 DetailsView?
【发布时间】:2013-08-12 12:17:40
【问题描述】:

我有一个类 RM.Member,它扩展了 Microsoft ProfileBase 类。

我需要将它绑定到 DetailsView,例如。

dvRegistration.DataSource = RM.Member.UserById(nodeId);

其中 RM.Member.UserById(nodeId) 返回 RM.Member 类型

我遇到了错误

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

不确定如何让它工作?

【问题讨论】:

    标签: data-binding datasource umbraco dataview asp.net-profiles


    【解决方案1】:

    看起来你有类型转换问题...

    您的 DetailsView 控件接受列表或 IEnumerable ...作为 DataSource 并且您从 RM.Member.UserById 方法返回其他内容 ....

    它的类型不匹配...

    尝试使用 .toList() 将 UserById 的返回类型转换为列表 ... 或将其转换为列表

    【讨论】:

      猜你喜欢
      • 2011-10-02
      • 1970-01-01
      • 2011-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多