locked
mvc 4 model binding RRS feed

  • Question

  • I have 3 models that I use to bind to a form. the models are as follows

    public class ParentModel
    {
        public string name { get; set; }
    
        public ICollection<ChildModel> children { get; set;}
    }
    
    public class ChildModel
    {
        public string name { get; set; }
    
        public ICollection<GrandchildModel> grandchildren { get; set;}
    }
    
    public class GrandchildModel
    {
        public string name { get; set; }
    }

    Now what needs to happen is the user comes in to create the parent, clicks on the add child button that creates a textbox and a button then for everyone created one you have the option to create an grandchild. now binding this to the model is the problem im faced with.

    • Moved by Caillen Monday, December 30, 2013 7:58 AM
    Sunday, December 29, 2013 7:51 PM

Answers

  • Hi Ernie de Bruin,

    Please post ASP.NET questions in ASP.NET forums:

    ASP.NET Forums >> General ASP.NET >> MVC

    Thanks for your understanding.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Monday, December 30, 2013 2:47 PM
    • Marked as answer by Just Karl Tuesday, January 7, 2014 4:16 PM
    Monday, December 30, 2013 7:58 AM