【发布时间】:2015-10-20 10:09:40
【问题描述】:
我有这样的课
class BroadCast
{
public string Comment{ get; set; }
public DateTime Date{ get; set; }
public List<string> DisplayUsers { get; set; }
}
我将List<BraodCast> 绑定到Repeater。到目前为止,Repeater 中只有两列,但我现在需要再添加一列以显示DisplayUsers 的列表。我正在考虑在中继器内使用ListView,所以我将其绑定如下
<asp:ListView ID="lstDisplayRole" runat="server" DataSource='<%# Eval("DisplayUsers") %>' >
<ItemTemplate>
<asp:Label ID="lblRoleName" runat="server" ForeColor="Black" Text='<%#Eval(index)%>' />
</ItemTemplate>
</asp:ListView>
index 什么都不是,我正在寻找可以使我的列表视图工作的东西。我的意思是,如果它是DataTable 而不是List<string>,那么使用Eval("ColumnName") 会非常容易,但这不是这里的情况,我没有列,它只是一个字符串列表。我怎样才能做到这一点?
【问题讨论】: