Unable to fill datasource in kendo grid

4 posts, 0 answers
  1. Rohit
    Rohit avatar
    5 posts
    Member since:
    Jul 2015

    Posted 01 May Link to this post

    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.


           

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 04 May Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rohit
    Rohit avatar
    5 posts
    Member since:
    Jul 2015

    Posted 07 May Link to this post

    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.

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 10 May Link to this post

    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
Back to Top