1
我想綁定使用Kendo UI Asp.Net MVC Grid的模型中的列表屬性,但我不能。如何綁定到Kendo UI模型中的列表屬性Asp.Net MVC
這裏是我的VieModel:
var userList = allUsers.Select(p => new UserViewModel
{
UserId = p.Id,
UserName = p.UserName,
Name = p.Name,
LastName = p.LastName,
HospitalCode = p.HospitalCode,
HospitalName = p.HospitalName,
RelatedHospitals = userHospitals.Where(t => t.UserId == p.Id).Select(x => new Hosp { HospitalId = x.HospitalCode, HospitalName = x.HospitalName }).ToList(),
PhoneNumber = p.PhoneNumber,
OfficePhone = p.OfficePhone,
Email = p.Email,
UserRoleName = p.UserRoleName,
City = p.CityName,
CityTownName = p.CityTownName,
UserTracks =context.UserTracks.Where(t=>t.UserId==p.Id).Select(x => new UserTrck { LastLoginDate = x.LastLoginDate, LocalIp = x.LocalIp, LastUsedWebBrowser = x.LastUsedWebBrowser }).ToList(),
CreatedDate = p.CreatedDate,
UpdatedDate = p.UpdatedDate
});
});
這裏是我的網格約束,且我嘗試:
columns.Bound(p => p.LastLoginDate).ClientTemplate("#=UserTracks[0].LastLoginDate#").Filterable(false).Sortable(false).Width(220);
但這不能幫助我。
如何在Kendo UI MVC Grid中使用模型列表。
感謝