Asp.net mvc 如何使用mvc在视图中将多个模型数据显示到单个Html表中
这是两个模型Asp.net mvc 如何使用mvc在视图中将多个模型数据显示到单个Html表中,asp.net-mvc,Asp.net Mvc,这是两个模型 public class Employee { public int Id { get; set; } public string EmployeeName { get; set; } public string City { get; set; } public string MobileNo { get; set; } public string Email { get; set; } public int DepartmentI
public class Employee
{
public int Id { get; set; }
public string EmployeeName { get; set; }
public string City { get; set; }
public string MobileNo { get; set; }
public string Email { get; set; }
public int DepartmentId { get; set; }
}
public class Department
{
public int DepartmentId { get; set; }
public string DepartmentName { get; set; }
}
现在,如何在视图中使用ViewModel将两个模型数据显示到单个Html表中,使用Model.addattributeobj1、you_object1等等,处理程序方法必须返回新的Model和viewyour_页面名称。在jsp页面中,您可以使用EL将它们显示为以下${obj1\u key}