I am trying something simple, or what should be simple. Creating a Kendo MVC Grid, and populating it via Ajax. Before you suggest it, I have looked in the developer tools in Chrome, and there are no Javascript errors whatsoever. No exceptions in the code, and no javascript errors. It will most likely be something simple, but I just cannot seem to find it.
I have placed a breakpoint in the action in which it should be calling, and it never, ever even calls it. If it at least called it, I'd know where to start looking, but it never calls it. And again, no javascript errors whatsoever, as shown in the attached screen capture.
My cshtml page:
@{
ViewBag.Title =
"Index"
;
}
<h2>Index</h2>
@(Html.Kendo().Grid<User>()
.AutoBind(
true
)
.Name(
"userGrid"
)
.Columns(cols => {
cols.Bound(c => c.UserId);
cols.Bound(c => c.FirstName);
cols.Bound(c => c.LastName);
cols.Bound(c => c.UserName);
})
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(
true
)
.PageSizes(
true
)
.ButtonCount(5))
.DataSource(ds => ds
.Ajax()
.Read(r => r.Action(
"AllUsers"
,
"Home"
).Type(HttpVerbs.Get))
.PageSize(20))
)
My Controller is also just as simple:
using
System.Collections.Generic;
using
System.Web.Mvc;
using
Kendo.Mvc.Extensions;
using
Kendo.Mvc.UI;
using
TelerikMVC_Template.Models;
using
TelerikMVC_Template.Repository;
namespace
TelerikMVC_Template.Controllers
{
[Authorize]
public
class
HomeController : Controller
{
private
readonly
IUserRepository userRepository =
new
UserRepository(
new
VUsersContext());
// GET: Home
public
ActionResult Index()
{
return
View();
}
[HttpGet]
[ActionName(
"AllUsers"
)]
public
JsonResult AllUsers([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<User> theseUsers = userRepository.SelectAll();
return
Json(theseUsers.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
}
}
And finally my User class definition:
public
class
User
{
public
System.Guid UserId {
get
;
set
; }
public
string
UserName {
get
;
set
; }
public
string
Email {
get
;
set
; }
public
string
FirstName {
get
;
set
; }
public
string
LastName {
get
;
set
; }
public
string
Comment {
get
;
set
; }
public
string
Password {
get
;
set
; }
public
System.DateTime LastLoginDate {
get
;
set
; }
public
System.DateTime LastPasswordChangedDate {
get
;
set
; }
public
System.DateTime CreationDate {
get
;
set
; }
public
bool
IsLockedOut {
get
;
set
; }
public
bool
IsActive {
get
;
set
; }
public
int
FailedPasswordAttemptCount {
get
;
set
; }
public
System.DateTime? LastPasswordFailedDate {
get
;
set
; }
public
System.DateTime CreatedDate {
get
;
set
; }
}