I have a viewmodel and it has a nested class what is not in connection other model class. I can fill the necessary data in this nested class (ClassX) to show those in the view but I can't get out data from the nested class (through MyViewModel) in the post action just when I give it in post action as another parameter. It appears in original viewmodel (MyViewModel) but its attributes are null/0.
public class MyViewModel
{
public MyViewModel()
{
classX = new ClassX();
}
public ClassX classX;
public int attrA {get;set;}
...
}
public class ClassX {}
//
// POST: /MyModel/Create
public ActionResult Create(MyViewModel myvm, **ClassX cx**, FormCollection collection)
{}
My question: Can I read data out from the nested class through the viewmodel class?