English 中文(简体)
MVC3 - 复杂模型,房地产有相同的外地名称,无法提供模型
原标题:MVC3 - complex model, properties have same field name, unable to render model

I need help in rendering a complex model.

我有一个复杂的模式,有2种类型特性。 所有3个班级(项目QnrModel、项目Model、QTModel)都有小组 Id and GroupName Property.

public class AddProjectQnrModel
    {
        [Required]
        public int GroupId { get; set; }

        public string GroupName { get; set; }

        public ProjectModel Project { get; set; }

        public QCTModel QCT { get; set; }
    }

我认为,我使用了编辑模板:

@Html.EditorFor(x => x.Project, "_EditProject.cshtml")
@Html.EditorFor(x => x.QCT, "_QCT-v1.cshtml")

我不能使用@html。 部分由于不会正确约束这些财产,因此我不得不使用编辑模板。

在管理项目时,我发现这一错误:

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:         
问题回答




相关问题
What do you have in your Model class?

What do you have in your model classes. Generally if i use any framework or any library (Zend Framework) , my classes only have variable which is table name . I know that in complicated applications ...

Rails Model With Aggregrate Data (not backed by a table)

Id like to create a model in rails that does not correlate to a table in the database. Instead the model should dynamically pull aggregrate data about other models. Example: I have a Restaurant ...

Trouble changing databases for my models in codeigniter

I m making a website with two different databases. Let s say one is DB1, and the other is DB2. I ve set up my database.php in the config folder, so they each have the correct host/password/username/...

EMAIL server FSP model

For my assignment I need to develop FSP model for email server and client. I manage to write simple model which describes one user, server and his mailbox, but I am having problems changing this ...

Rails Custom Model Functions

I m in a databases course and the instructor wants us to develop an e-commerce app. She said we can use any framework we like, and now that we re halfway through the semester she decided that Rails ...

热门标签