In a standard setup of Parent Child relation, lets say Project and Task. Where a Project is made up of lots of Tasks. So in a standard RDB, we have a
Project (ID, Name, Deadline)
Task (ID, FK_To_Project, Name, Description, isCompleted)
this is all very straight forward.
We have an MVC View that views Projects, so we get a nice list of all the project Names next to each deadline.
Now we want to CREATE a new PROJECT.
The Edit view opens, we type a name, say, 'Make a cup of Tea', with tomorrow as the deadline!
Still in this view/web page, I would like a list of all the Child Tasks, in a standard list, with Edit, Delete, and a Create/Add Task button too, just below the 'parent table' details.
The simplest way to describe this, is the Parents Table Create/Edit view, with the Childes List View Below it.
The ideal solution will also allow开发者_如何学JAVA my Child Table (Tasks) to have Children also (for more complex scenarios) , and so on, and on, and on.
If I navigate away from my Created Project, I don’t want all sorts of random stuff laying around, they went away, it’s gone!
I’d expect all the same functionality when Editing an existing project.
I’m struggling with the ‘Add New Child’, I had a model dialog (jQuery) and all was well, but now when editing an existing child/task, I need to populate the Child Edit, which is a pain and will need loads of java script I think.
How can this be achieved in MVC, does anybody have any examples?
I know this is a very late reply, but I've posted a screenshot of my first MVC project which seems to deal with exactly the same Parent - Child relationship and presentation style that you are describing. See if the is what you are shooting for.
Screenshot: http://mattslay.com/wp-content/uploads/2018/07/mvc-crud-app.png
精彩评论