Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @{ Html.RenderPartial("_DataList", new DataListModel(Model.country.province)); }
- public virtual ICollection<Province> province { get; set; }
- public class DataListModel
- {
- [Key]
- public int id { get; set; }
- public IEnumerable<DataListItem> src { get; set; }
- public DataListModel(ICollection<Province> pColl)
- {
- id = 1;
- src = (from item in pColl
- select new DataListItem(item.id, item.name)).ToList();
- }
- @model MyProject.Models.DataListModel
- @{
- foreach(MyProject.Models.DataListItem item in Model.src)
- {
- @Html.Label(item.ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement