Grid doesn't display when remote binding

5 posts, 1 answers
  1. Johannes
    Johannes avatar
    32 posts
    Member since:
    Feb 2017

    Posted 17 Mar 2017 Link to this post

    I am currently evaluating Telerik at the moment and we are currently trying to get our application to use the Grid widget to display a list of "Terms". The grid works semi-nicely when we parse a Model to the partial view and then use the Model with the grid. Model is below;

     

        public class Term
        {
            [Key]
            [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
            public int TermID { get; set; }
            [Required]
            public string TermName { get; set; }
            public string TermDescription { get; set; }
            public bool Preferred { get; set; }
        }

     

    The problem is that there can be an unlimited amount of "Terms" so we have tried to use remote binding. However, when we use remote binding, the Grid widget doesn't show up at all. The method in the controller gets the data, and the browser seems to retrieve the json (according to Fiddler).

    Controller Method

            public ActionResult _TermTable([DataSourceRequest]DataSourceRequest request)
            {
                using (IVContext db = new IVContext())
                {
                    return Json(db.Terms.ToDataSourceResult(request),JsonRequestBehavior.AllowGet);
                }
            }

    Partial View

    @(Html.Kendo().Grid<DemoSpace.Models.Term>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.TermID);
            columns.Bound(p => p.TermName);
            columns.Bound(p => p.TermDescription);
            columns.Bound(p => p.Preferred);
        })
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(20)
            .ServerOperation(true)
            .Read(read => read.Action("_TermTable", "Admin"))
         )
    )

    I know that I am going to be missing something obvious, but I just can't see it.

     

    Any and all help is appreciated.

     

  2. Answer
    Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 20 Mar 2017 Link to this post

    Hi Johannes,

    The configuration and the action method seems correct. Nevertheless, you could take a look at our help topic for the AJAX binding:
    You could also inspect the browser`s console and see if there are any JavaScript errors that could help us pinpoint the root of the problem.

    Finally, you could go through the following troubleshooting section and see if this applies to your case:

    Regards,
    Konstantin Dikov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Johannes
    Johannes avatar
    32 posts
    Member since:
    Feb 2017

    Posted 20 Mar 2017 in reply to Konstantin Dikov Link to this post

    Thanks for the response.

    I have noticed that I am using HttpGet instead of HttpPost. I have attempted to make it use Post but it says that it can not find the action. The Get still seems to return the right data though. I have attached the response as a PNG.

    I have also got the Microsoft.jQuery.Unobtrusive.Ajax NuGet package in my application. Would this somehow interfere with the widget working?

     

     

     

  4. Johannes
    Johannes avatar
    32 posts
    Member since:
    Feb 2017

    Posted 20 Mar 2017 in reply to Johannes Link to this post

    Johannes said:

    ...

    I have also got the Microsoft.jQuery.Unobtrusive.Ajax NuGet package in my application. Would this somehow interfere with the widget working?

     

    This does not interfere as I took it out and attempted to make it work. Still nothing.

  5. Johannes
    Johannes avatar
    32 posts
    Member since:
    Feb 2017

    Posted 21 Mar 2017 in reply to Johannes Link to this post

    The problem I was having was that I was loading it in a partialview that was loaded after another partialview. Now I have put it straight into the first partialview, it seems to work. No idea why this would be the case but it now works.
Back to Top