Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public class MyPageModel
- {
- //this is my marriage list and to use anywhere on my codes
- Public List<Sub_MarriageModel> MarriageList { get; set; }
- //this is person list selected marriage is in this list
- Public List<Person> PersonList{get;set;}
- }
- public class Sub_MarriageModel
- {
- public int ID{ get; set; } // 0,1,2
- public string Name { get; set; } //single,married
- }
- public class Person
- {
- public int SelectesState{ get; set; } // 0,1,2
- }
- @for (int i=0;i<Model.MarriageList.Count;i++)
- {
- @Html.DropDownListFor(m=>m.PersonList[i].SelectesState,
- new SelectList(Model.MarriagesList, "ID", "Name"))
- }
- <select id="PersonList_0__SelectesState" name="PersonList[0].SelectesState">
- <option value="0">Single</option>
- <option value="1">Married</option>
- <option value="2">Unknow</option>
- </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement