MVC3 ModelBinding to a collection posted back with index gaps
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 each object. @Html.EditorFor(model => model.MyObjects) This has worked well for a while now, and when you check the html, my text boxes are prefixed with the model property, followed by the index of the collection they came from. <input class="text-box single-line" id="MyObjects_2__SomeProperty" name="MyObjects[2].SomeProperty" type="Text" value="" /> However I've recently started using the ShowForEdit and ShowForDisplay