Click here to Skip to main content
15,888,263 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, Im having a problem implementing a list collection of a class in MVC 5. I know there are solutions or examples how to do this in earlier versions of MVC like this one in this blog post but I cannot belive that in the next three versions of MVC this wasnt implemented more gracefuly or elegantly.

I have a model class that consists of several properties and one of them is a list collection of another entity. In my form I want to let the user set the number of fields and and then render them with correct id's so that the model binder will recognize that this is the data for the list collection. Something like in this Fiddle.

Is there a newer example or blog post describing this scenario becouse I can not seem to be able to find it.

Thank you.
B
Posted

1 solution

Hi I hope this is what you are looking for.

take a small model for your controls which you want to populate in a div on any button click and load it back with blank model properties through ajax or jQuery post methods.

And In main model take the list for child model

[ a small demo you can see in this blog]


:-)
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900