这个问题在这里已有答案:
我有一个Dictionary<string,List<object>>
,我想迭代它,并希望绑定cshtml页面上的列表值。我得到的值为:
这是我的cshtml页面,我循环通过qazxsw poi
Dictionary<string,List<object>>
我的问题是如何遍历字典,我可以将标题作为键和值作为对象列表。感谢你
我写了一段时间回来了一个将目录结构输出到xml的项目。您可以轻松修改此代码:
<div class="content">
<div class="quote-slider full-bottom" data-snap-ignore="true">
@foreach (var PriceList in Model.ProductPriceDicList)
{
<div>
<br />
<h4 style="font-weight:bold; color:red">@PriceList.Key</h4>
<table >
@foreach (var DicPriceList in Model.ProductPriceDicList.Values)
{
<tr>
<td style="padding:0px">
<table style="margin-bottom:0px; border:none" >
<tr style="padding:0px">
<td>
@DicPriceList[Convert.ToInt32(PriceList.Key)].SubProductName
</td>
<td>
@DicPriceList[Convert.ToInt32(PriceList.Key)].ProductCost
</td>
<td>
<em class=" fa fa-eye"> </em>
</td>
</tr>
</table>
</td>
</tr>
}
</table>
</div>
}
</div>