asp.net mvc - Passing collection as model without ordered index -
i have list of objects , i'm passing view , rendered properly.
when submit form, i'm getting getting same model. works fine. unfortunately, when decide delete dynamically record using jquery, looks 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
Post a Comment