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

Unable to fill datasource in kendo grid

3 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rohit
Top achievements
Rank 1
Rohit asked on 01 May 2016, 01:04 PM

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.


       

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 04 May 2016, 11:44 AM
Hello,

Please examine the following example that illustrates how yo can populate the Grid HtmlHelper with data from a remote service.


Also check out the troubleshooting section in the documentation that lists some common issues and see how the suggestions there are working for you.




Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Rohit
Top achievements
Rank 1
answered on 07 May 2016, 07:23 AM

Hi, 

    Thanks for the documentation. I sorted the issue.

     Now i want to add a button in toolbar for exporting to excel. I want to implement this functionality in vb.net . But as of now i didn't got any success. 

    Can you please provide me with help in implementing export functionality in vb.net. It would be a great help.

0
Viktor Tachev
Telerik team
answered on 10 May 2016, 02:05 PM
Hi,

In order to enable export for the Grid you need to add the Export to Excel button and configure the properties for the exported file.

Check out the following resources that illustrate the approach:



Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Rohit
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Rohit
Top achievements
Rank 1
Share this question
or