【发布时间】:2015-07-16 08:55:31
【问题描述】:
public class Student { public string Name; public int Age; } List<Student> StudentList = new List<Student> { new Student{ Name = "Handri", Age = 8 }, new Student{Name = "Jon Galloway", Age = 10}, new Student{ Name = "Scott Hanselman", Age = 9} }; public class Teacher { public string Name; public int Age; } List<Teacher> TeacherList = new List<TeacherList> { new TeacherList { Name = "Jhon", Age = 30 }, new TeacherList {Name = "JANE", Age = 25}, new TeacherList { Name = "Peter", Age = 27} };
我的模型需要多个视图;
.................................................. ..................................................... ..................................................... .......
【问题讨论】:
-
不要使用“动态”,这是一个流行词。准确解释您要做什么。您在寻找
foreach()循环吗?你的意思是Student在你的代码中有Blog吗? -
我使用@model 动态
<tbody> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(m=> item.Name) -
那么你的问题是什么?
-
我需要在模型
@Html.DisplayNameFor(m => model.name)的网格中添加标题 -
您的列表中有 2 种数据类型吗?
标签: c# asp.net-mvc razor