I have adapted the code from the example, but no data displayed.
Viewcode:
01.
@(Html.Kendo().MobileView()
02.
.Title("EntityFramework DataAccess")
03.
.Name("Index")
04.
.Content(@<
text
>
05.
06.
@(Html.Kendo().Grid<
vEF_Library.Address
>()
07.
.Name("grid")
08.
.DataSource(dataSource => dataSource // Configure the grid data source
09.
.Ajax() // Specify that ajax binding is used
10.
.Read(read => read.Action("Products_Read", "Home")) // Set the action method which will return the data in JSON format
11.
)
12.
.Columns(columns =>
13.
{
14.
// Create a column bound to the ProductID property
15.
columns.Bound(address => address.LastName);
16.
// Create a column bound to the ProductName property
17.
columns.Bound(address => address.FirstName);
18.
// Create a column bound to the UnitsInStock property
19.
columns.Bound(address => address.Phone);
20.
})
21.
.Pageable() // Enable paging
22.
.Sortable() // Enable sorting
23.
)
24.
</
text
>)
25.
)
Controllercode:
01.
namespace
vEF_AspApplication.Controllers
02.
{
03.
public
class
HomeController : Controller
04.
{
05.
public
ActionResult Products_Read([DataSourceRequest]DataSourceRequest request)
06.
{
07.
using
(var db =
new
vEF_Library.MyDataModelContext())
08.
{
09.
IQueryable<Address> products = db.Addresses;
10.
DataSourceResult result = products.ToDataSourceResult(request);
11.
return
Json(result);
12.
}
13.
}
14.
}
15.
}
Results, see attached screenshots.