Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. Public class MyPageModel
  2. {
  3. //this is my marriage list and to use anywhere on my codes
  4. Public List<Sub_MarriageModel> MarriageList { get; set; }
  5.  
  6. //this is person list selected marriage is in this list
  7. Public List<Person> PersonList{get;set;}
  8. }
  9.  
  10. public class Sub_MarriageModel
  11. {
  12. public int ID{ get; set; } // 0,1,2
  13. public string Name { get; set; } //single,married
  14. }
  15.  
  16. public class Person
  17. {
  18. public int SelectesState{ get; set; } // 0,1,2
  19. }
  20.  
  21. @for (int i=0;i<Model.MarriageList.Count;i++)
  22. {
  23. @Html.DropDownListFor(m=>m.PersonList[i].SelectesState,
  24. new SelectList(Model.MarriagesList, "ID", "Name"))
  25. }
  26.  
  27. <select id="PersonList_0__SelectesState" name="PersonList[0].SelectesState">
  28. <option value="0">Single</option>
  29. <option value="1">Married</option>
  30. <option value="2">Unknow</option>
  31. </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement