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++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -