aspx视图引擎 list ,遍历集合

 

<%@ Import Namespace="MvcFirstDemo.Models" %>--伪数据

<% List<UserInfo> list = ViewData["cc"] as List<UserInfo>;%>
<table>
<tr>
<th>用户编号</th><th>姓名</th><th>年龄</th>
</tr>


<% foreach (var dt in list)
{%>
<tr>
<td><%:dt.Id%></td>
<td><%:dt.Name %></td>
<td><%:dt.Age %></td>
</tr>

<% }%>

</table>

posted on 2015-07-23 14:49  gocool  阅读(688)  评论(0编辑  收藏  举报