Tôi cần trợ giúp để hiển thị một mô hình phức tạp.MVC3 - mô hình phức tạp, các thuộc tính có cùng tên trường, không thể hiển thị mô hình
Tôi có một mô hình phức tạp với 2 thuộc tính lớp học. Tất cả 3 lớp (AddProjectQnrModel, ProjectModel, QTModel) đều có các thuộc tính GroupId và GroupName.
public class AddProjectQnrModel
{
[Required]
public int GroupId { get; set; }
public string GroupName { get; set; }
public ProjectModel Project { get; set; }
public QCTModel QCT { get; set; }
}
Trong giao diện Tôi đang sử dụng các mẫu biên tập:
@Html.EditorFor(x => x.Project, "_EditProject.cshtml")
@Html.EditorFor(x => x.QCT, "_QCT-v1.cshtml")
tôi không thể sử dụng @ html.Partial vì nó sẽ không ràng buộc các thuộc tính một cách chính xác, vì vậy tôi phải sử dụng các mẫu biên tập.
On chạy dự án tôi nhận được lỗi này:
Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: required
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: required
Source Error:
Line 26:
Line 27: @Html.EditorFor(x => x.Project, "_EditProject.cshtml")
Line 28:
Line 29: