2
votes

I created a Person Model which contains the same fields (Name, ID, Phone, Email). I also have a Nomination Model that contains the Person Model 4x's for different types of people (a submitter, a submitee, a reference, and a manager).

I then created one Partial View that was strongly typed to the Person Model. My Submitter View then renders the Partial View 4x's (ex. @Html.Partial("_Person", Model.Manager)) for each of the 4 types of people.

However, when the form is submitted, the Partial View's all return Null data.

Now, I've been able to get this to work by strongly typing all the fields indepedently, but, it seems like I should be able to use a Partial View to not have to type out 4 different Name, ID, Phone, and Email fields.

Is there a way to do repeat a partial view multiple times like this?

1

1 Answers

1
votes

Is the form submitted in one shot? If this is the case then the model binding is failing because the names are the same, and mvc gets confused if you use the same names for the person model for one post back.

Let me know as I had this problem once as well, you might want to just pass the nomination model instead and you should find that it should work if in fact your model is failing because of several different objects having the same name.