asp.net mvc - Passing collection as model without ordered index -


i have list of objects , i'm passing view , rendered properly. enter image description here

when submit form, i'm getting getting same model. works fine. unfortunately, when decide delete dynamically record using jquery, looks enter image description here after submitting form, i'm getting list 2 first items. it's probably, because indexes arent in natural order (0,1,3 instead of 0,1,2). there fix (not using jquery change inputs, smth server sided)? i've tried change array list or ienumerable still nothing. know pack , send json or read formcollection, i'd ask here first , see if there other solution.

you need include input index property allows post non consecutive indexers. value of index must match collection indexer. example

for(int = 0; < model.taglist.count; i++) {   @html.textboxfor(m => m.taglist[i].name);   <input type="hidden" name="taglist.index" value="@i" /> } 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -