Ho bisogno di aiuto per il rendering di un modello complesso.MVC3 - modello complesso, le proprietà hanno lo stesso nome campo, impossibile rendere il modello
Ho un modello complesso con 2 proprietà di classe. Tutte le 3 classi (AddProjectQnrModel, ProjectModel, QTModel) hanno proprietà GroupId e 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; }
}
Nella vista sto usando Editor modelli:
@Html.EditorFor(x => x.Project, "_EditProject.cshtml")
@Html.EditorFor(x => x.QCT, "_QCT-v1.cshtml")
non posso usare @ html.Partial in quanto non si legherà in modo corretto le proprietà, quindi devo usare Editor modelli.
Sulla gestione del progetto ottengo questo errore:
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: