Hi,
I am using MVC4 with Entity Framework 5 and I have the following piece of code that I got using samples posted on your website. Apparently, the Grid does not load at all. Am I missing something here?
I do want to mention that the Admin controller is in an "Admin" Area and I have routed requests to the Admin section correctly. Also the UnitOfWork object returns an IEnumerable object which I transpose to Kendo's DataSourceRequest. Currently, this function returns two objects in my test cases and I can see that when I go directly to the url that is bound to the read portion of the dataSource object.
Below is the Controller code.
Here is the View:
Could you please tell me why the Grid won't load the data?
Thanks,
Akshay
I am using MVC4 with Entity Framework 5 and I have the following piece of code that I got using samples posted on your website. Apparently, the Grid does not load at all. Am I missing something here?
I do want to mention that the Admin controller is in an "Admin" Area and I have routed requests to the Admin section correctly. Also the UnitOfWork object returns an IEnumerable object which I transpose to Kendo's DataSourceRequest. Currently, this function returns two objects in my test cases and I can see that when I go directly to the url that is bound to the read portion of the dataSource object.
Below is the Controller code.
Imports PropertyCentral.Domain.EntitiesImports PropertyCentral.Domain.InterfacesImports PropertyCentral.Domain.RepositoriesImports Kendo.Mvc.UIImports Kendo.Mvc.ExtensionsNamespace Admin.Controllers '<Authorize(Roles:="Administrator")> Public Class UsersController Inherits System.Web.Mvc.Controller Private _uow As IUnitOfWork Public Sub New(uow As IUnitOfWork) If uow Is Nothing Then Throw New ArgumentNullException("uow") End If _uow = uow End Sub ' ' GET: /Admin/Users Function Index() As ActionResult Dim users = _uow.Users.SelectAll().AsEnumerable() Return View("~/Areas/Admin/Views/Users/Index.vbhtml", users) End Function ' ' GET: /Admin/Users/Users_Read Function Users_Read(<DataSourceRequest()> request As DataSourceRequest) As ActionResult Dim users = _uow.Users.SelectAll().AsEnumerable() Return Json(users.ToDataSourceResult(request), JsonRequestBehavior.AllowGet) End Function End Class
End NamespaceHere is the View:
@ModelType System.Collections.Generic.IEnumerable(Of PropertyCentral.Domain.Entities.User)@Code ViewData("Title") = "Administration/Users" Layout = "~/Views/Shared/_Layout.vbhtml"End Code<div class="widget-box"> <div class="widget-title"> <span class="icon"> <i class="icon-th"></i> </span> <h5>Users</h5> </div> <div class="widget-content nopadding"> @*<div id="userGrid" style="height:380px;"></div> *@ @Code Html.Kendo.Grid(Of PropertyCentral.Domain.Entities.User)(Model) _ .Name("UserGrid") _ .Columns(Sub(column) column.Bound(Function(u) u.UserID) column.Bound(Function(u) u.UserName) column.Bound(Function(u) u.FirstName) column.Bound(Function(u) u.LastName) column.Bound(Function(u) u.EmailAddress) column.Bound(Function(u) u.PhoneNumber) End Sub) _ .DataSource(Sub(dataSource) dataSource _ .Ajax() _ .Read(Sub(read) read.Action("Users_Read", "Users", New With {.Area = "Admin"}) End Sub) End Sub) End Code </div></div>Thanks,
Akshay