Hi,
I am working on kendo grid sample App. Where i am getting list of records from WCF service and trying to bind to Kendo Grid. However while returning from controller ,instead of displaying grid ,i am getting download popup with json file and then program terminates.
Following is my controller:-
Function Display(<DataSourceRequest> request As DataSourceRequest) As ActionResult
Dim products As List(Of ServiceReference1.Empolyee) = New List(Of ServiceReference1.Empolyee)
Dim d As New ServiceReference1.Service1Client()
products = d.GetData()
Return Json(products.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)
Vbhtml page:-
@modelType list(of Display_Data.ServiceReference1.Empolyee)
@imports Kendo.Mvc.UI
<link href="~/Content/kendo/2016.1.412/kendo.common.min.css" rel="stylesheet" />
<link href="~/Content/kendo/2016.1.412/kendo.default.min.css" rel="stylesheet" />
<script src="~/Scripts/kendo/2016.1.412/kendo.all.min.js"></script>
@Code
Html.Kendo().Grid(Of Display_Data.Empolyee)() _
.Name("Grid") _
.Columns(Sub(c)
c.Bound(Function(p) p.Name)
c.Bound(Function(p) p.Age)
End Sub) _
.Sortable() _
.Filterable() _
.Events(Function(e) e.DataBound("onDataBound")) _
.DataSource(Sub(d)
d.Ajax().Read(Function(read) read.Action("Display", "Student")).Model(Sub(m)
m.Id(Function(i) i.Name)
End Sub)
End Sub) _
.Render()
End Code
Model class: -
Imports System.ComponentModel.DataAnnotations
Public Class Empolyee
Public Property Name As String
Public Property Age As String
End Class
Can anyone please suggest me what am i missing?
Is the vbhtml page correct ?
Will the Datasource will get populated with the list?
Attached is the snapshot of file which i get as output on returning json.