MVC3 ModelBinding to a collection posted back with index gaps

前端 未结 2 1977
情话喂你
情话喂你 2021-01-13 03:26

I have a collection of objects on my Model that I\'m rendering in a View by using EditFor function, and I have an EditorTemplate which is responsible for actually rendering

2条回答
  •  情歌与酒
    2021-01-13 04:05

    There are some very good blog posts that allow you to modelbind to a list without the need to provide zero based contiguous index. plz have a look at http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/
    http://zahidadeel.blogspot.com/2011/05/master-detail-form-in-aspnet-mvc-3-ii.html
    Furthermore, if you are interested in MVVM pattern and knockout js you can check this great work by steve sanderson
    For more reading put "editing varibale length list mvc style" in google and it will give u a dozen useful links

提交回复
热议问题