If you pass an anonymous object back to the controller, it populates controller arguments by looking at the anonymous object property names - so how would I pass back properties of related objects to my model so that the default value binder can bind them?
For example:
Model:
public class MyViewModel
{
public MyItem MyItem { get; set; }
}
public class MyItem
{
public string Name { get; set; }
}
Controller:
public ActionResult Index(MyViewModel model)
{
return View(model);
}
In the view, I want to pass the MyItem.Name back, how is this possible? I have tried:
@Html.ActionLinke("Index", "MyController", new { name = "example" })
and
@Html.ActionLinke("Index", "MyController", new { myItem_Name = "example" })
Help please!