This is a migrated thread and some comments may be shown as answers.

Json data not getting displayed in Kendo Grid

1 Answer 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rohit
Top achievements
Rank 1
Rohit asked on 11 Jul 2015, 01:11 PM

Hi, 

I am unable to bind the kendo grid with the Json data which returns a list of items.

following is my controller code  :

Function Display(<DataSourceRequest> request As DataSourceRequest) As ActionResult
        Dim l As List(Of ServiceReference1.Cust_Detail) = New List(Of ServiceReference1.Cust_Detail)

        Dim d As New ServiceReference1.Service1Client()

        l = d.Display()

        Return Json(l.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)

    End Function

 

Following is my View code :-

@Code
             Html.Kendo().Grid(Of Test_MVC_kendo.Cust_Detail)() _
                 .Name("Grid") _
                 .Columns(Sub(c)
                              c.Bound(Function(p) p.Cust_ID)
                              c.Bound(Function(p) p.Cust_Name)
                              c.Bound(Function(p) p.Cust_City)
                              c.Bound(Function(p) p.Cust_Age)
            
                          End Sub) _
             .Sortable() _
             .Filterable() _
             .Events(Function(e) e.DataBound("onDataBound")) _
             .DataSource(Sub(d)
                             d.Ajax().Read(Function(read) read.Action("Show", "Customer")).Model(Sub(m)
                                                                                                     m.Id(Function(i) i.Cust_ID)
                                                                                                 End Sub) _
                             .Read(Function(read) read.Url("api/Customer").Type(HttpVerbs.Get)) _
                             .Create(Function(create) create.Url("api/Customer").Type(HttpVerbs.Post)) _
                             .Update(Function(update) update.Url("api/Customer").Type(HttpVerbs.Put)) _
                             .Destroy(Function(destroy) destroy.Url("api/Customer").Type(HttpVerbs.Delete))
                         End Sub) _
             .Render()
End Code

 

Following is my Model class :-

Public Class Cust_Detail
    <Required>
    <Range(1, 10)>
    Public Property Cust_ID As String
    <Required>
    Public Property Cust_Name As String
    <Required>
    Public Property Cust_Age As String
    <Required>
    Public Property Cust_City As String

End Class

Could anyone guide me please ,why i am unable to see the kendo grid bindinded

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 15 Jul 2015, 07:27 AM

Hello Rohit,

 

I can see that you have two read configurations that can cause the issue that you face. I would suggest you to check the following tutorial that shows how to bind the Grid using Ajax dataSource:

 

http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/ajax-editing

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Rohit
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or