asp.net mvc - How to render object collection as editable(checkboxes) list view -
First of all, I would like to say that I did many research, tried several ways but none of this works <00,00
My model class looks like this:
list of public category viewmodel {public entry id (get; set;} public string name {get; set;} public bull echacked {adap} Set;}} I'm seeing this as an IEnumerable collection. I'm trying to pack all form data in IEnumerable here Public functions edit visit list (list & lt; ListViewModel & gt; model) {Unfortunately, every attempt is made to fail, I am a Receiving null as a model (probably the model binder the way I I like it)
This is my latest attempt:
@forach (various items in the model) {& lt; Tr & gt; & Lt; TD & gt; @ Html.DisplayFor (m = & gt; item names) & lt; / Td> & Lt; TD & gt; @ Html.CheckBoxFor (m = & gt; Item .isi check, new {id = "[" + item.Id + "] .name"}) @HTML.Heddfor (M => item names) & lt ; / Td> & Lt; / TR & gt; }
simply foreach to get the right binding @for (var i = 0; i model [i] .name)} Look at the generated html, There are separate names and id attributes, which should be properly tie.
Comments
Post a Comment