晚安
想请教一下,我有个Class其结构如下
public class TotalMoneyClass
{
public List<string> DateStrList = new List<string>();
public List<int> CheckMoneyList = new List<int>();
public string storeName { get; set; }
};
然后我用个List<TotalMoneyClass>去存资料
foreach(string nameStr in mStore){
TotalMoneyClass tmp = new TotalMoneyClass();
tmp.storeName = nameStr;
for (int month = 1; month < 13; month++)
{
//若没有资料,就当作0
tmp.CheckMoneyList.Add(result.Where(i => i.mStoreName.CompareTo(nameStr) == 0 && i.shop_date.Month == month && i.shop_date.Year == 2017)
.Sum(t =>(int?) t.totalSale_money)??0);
}
listStore.Add(tmp);
}
Repeater1.DataSource = listStore;
Repeater1.DataBind();
而我想要用Repeater去呈现出TotalMoneyClass里的List<int> CheckMoneyList
那该怎么改写呢??
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound" >
<HeaderTemplate>
<table>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# ((TotalMoneyClass)Container.DataItem).storeName %></td>
<td><%# ((TotalMoneyClass)Container.DataItem).CheckMoneyList %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
谢谢