I need help rendering a complex model.
I have a complex model with 2 class properties. All 3 classes (AddProjectQnrModel, ProjectModel, QTModel) have the GroupId and GroupName properties.
public class AddProjectQnrModel
{
[Required]
public int GroupId { get; set; }
public string GroupName { get; set; }
public ProjectModel Project { get; set; }
public QCTModel QCT { get; set; }
}
In the view, I use editor templates:
@Html.EditorFor(x => x.Project, "_EditProject.cshtml")
@Html.EditorFor(x => x.QCT, "_QCT-v1.cshtml")
I cannot use @ html.Partial since it will not bind properties correctly, so I have to use editor templates.
When starting a project, I get this error:
Validation type names in unobtrusive client validation rules must be unique. The following type of check has been viewed more than once: required
Description: An unhandled exception occurred during the execution of the current web request. View the stack trace for error information and where it originated in the code.
: System.InvalidOperationException: . :
Source Error:
Line 26:
Line 27: @Html.EditorFor(x => x.Project, "_EditProject.cshtml")
Line 28:
Line 29: