谁有人在Mvc中制作多线网格?我怎么能这样做?请帮帮我。
由于
Vicky
答案 0 :(得分:0)
以下是您通常会如何做到这一点(请记住MVC中没有网格视图!)
<% if (Model != null && Model.Count() > 0) %>
<% { %>
<table>
<tr>
<th>
Object property 1 name
</th>
<th>
Object property 2 name..
</th>
</tr>
<% int i = 0; foreach (var item in Model) %>
<% { %>
<tr class="<%= i++ % 2 == 0 ? "cssPrimaryGridRow" : "cssAltGridRow" %>">
<td>
<%= Html.Encode(item.Property1)%>
</td>
<td>
<%= Html.Encode(item.Property2)%>
</td>
</tr>
<% } %>
</table>
<% } %>