Hopefully this is an easy one :)
I have a "Membership" Controller that serves up a WebsiteUser obect defined as so:
This is served up from the Membership/Index route:
Which is populated thusly:
It all works quite nicely until I try to do paging, sorting or other ajax calls. The grid simply empties.
Whacking a breakpoint on the Index() call the page is definitely calling it back, but we're not getting the data. I assume I'm doing something elementary wrong here, unfortunately the Razor guides are still a little sparse on the ground and I'm having trouble finding a Razor example that does what I need.
I have a "Membership" Controller that serves up a WebsiteUser obect defined as so:
public class WebsiteUser{ public string UserName { get; set; } public DateTime LoginTime { get; set; } public bool IsLoggedIn { get; set; }}This is served up from the Membership/Index route:
public ActionResult Index(){ List<WebsiteUser> Users = new List<WebsiteUser>(); foreach (MembershipUser user in Membership.GetAllUsers()) { Users.Add( new WebsiteUser() { UserName = user.UserName, IsLoggedIn = user.IsOnline, LoginTime = user.LastActivityDate }); } return View(Users);}Which is populated thusly:
@model IEnumerable<ATFWebsite.Controllers.WebsiteUser>@{ ViewBag.Title = "Index";}<h2>Membership</h2>@(Html.Kendo().Grid(Model) .Name("Grid") .Columns(columns => { columns.Bound(p => p.UserName).Groupable(false); columns.Bound(p => p.IsLoggedIn); columns.Bound(p => p.LoginTime); }) .Groupable() .Pageable() .Sortable() .Scrollable() .Filterable() .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("Index", "Membership") ) ))It all works quite nicely until I try to do paging, sorting or other ajax calls. The grid simply empties.
Whacking a breakpoint on the Index() call the page is definitely calling it back, but we're not getting the data. I assume I'm doing something elementary wrong here, unfortunately the Razor guides are still a little sparse on the ground and I'm having trouble finding a Razor example that does what I need.