asp.net mvc - Bind multiple models asp,net mvc -


i have model have multiple other models in it.

public class mainmodel {  public entity1 ();  public entity2 (); } 

after posting view, entity1 entities null? luck. doing wrong? question is: asp.net mvc multiple model in 1 view (create, update) how can class entities in model?

controller(homecontroller) :

public actionresult index()     {         mainmodel model=new mainmodel();         return view(model);     }  [httppost] public actionresult index(mainmodel model)     {         return view(model);     } 

view(home/index) :

@model mainmodel @using (html.beginform("index","home",formmethod.post))  {    <input type="submit" value="submit" />  } 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -