Created
October 13, 2013 22:28
-
-
Save mgroves/6968090 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p> | |
| <select name="Associations[0].SomeId"> | |
| <option value="">Select...</option> | |
| <option value="7">AAA</option> <!-- why isn't a value in the dropdown selected? --> | |
| <option value="8">BBB</option> | |
| <option value="9">CCC</option> | |
| </select> | |
| <!-- but yet, the value here is populated --> | |
| <input name="Associations[0].Foo" type="text" value="whatever"> | |
| </p> | |
| <p> | |
| <select name="Associations[1].SomeId"> | |
| <option value="">Select...</option> | |
| <option value="7">AAA</option> <!-- why isn't a value in the dropdown selected? --> | |
| <option value="8">BBB</option> | |
| <option value="9">CCC</option> | |
| </select> | |
| <!-- but yet, the value here is populated --> | |
| <input name="Associations[1].Foo" type="text" value="something else"> | |
| </p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @model MyNamespace.SomeViewModel | |
| @for (int i = 0; i < Model.Associations.Count; i++) | |
| { | |
| <p> | |
| @* SomeId property has an interger value, like 7 *@ | |
| @Html.DropDownListFor(a => a.Associations[i].SomeId, Model.SomeList, "Select...") | |
| @* Foo property has a string value, like "whatever" *@ | |
| @Html.TextBoxFor(a => a.Associations[i].Foo) | |
| </p> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment