的列表屬性我已經示範綁定到模型
public class FooContainer
{
public int ID { get; set; }
public string Name { get; set; }
public IList<Foo> Foos { get; set; }
}
public class Foo
{
public string Name {get; set; }
public string Description {get; set;}
}
以下實施例控制器
public class FooController : Controller
{
public ActionResult Index(){
return View(new FooContainer());
}
[HttpPost]
public ActionResult Index(FooContainer model){
//Do stuff with the model
}
}
我想創建一個視圖,其使用戶能夠CRUD FOOS。
現有的研究
我已閱讀以下內容:
http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx
與SO下面的文章以及
MVC4 Allowing Users to Edit List Items
MVC4 bind model to ICollection or List in partial
,所以我知道如何通過一個IEnumerable <>來回,問題是,我想通過一些容器,與包括一個IEnumerable <>
要求
我希望能夠綁定到這個複雜模型的其他屬性使其完全通過並全部傳遞給控制器。假設控制器不做任何事情,只是渲染視圖並在後期接收FooController模型。此外,我想要任何相關的文章或引用視圖語法需要啓用此。
在此先感謝
嘿,請在FooController中描述一種方法。 –
也許它可以幫助:谷歌'mvc4定製粘合劑' –
我正在調查MVC4定製粘合劑現在...他們看起來挺酷! –