Server Heirarchy examples

5 posts, 0 answers
  1. Erik
    Erik avatar
    42 posts
    Member since:
    Aug 2012

    Posted 12 Nov 2017 Link to this post

    Is there a server binding hierarchy web forms example floating around out there?

    I see example projects: server-hierarchy and server-binding but am having trouble understanding how to use it in a web forms based MVC project.

     

    In the view for server-binding example:

    @model IEnumerable<KendoGridServerBinding.Models.Product>
     
    @(Html.Kendo().Grid(Model) // Bind the grid to the Model property of the view

     

    and in the view for server-hierarchy example project:

    @(Html.Kendo().Grid((IEnumerable<KendoGridServerHierarchy.Models.Category>)ViewBag.Categories)

     

    Can someone explain the difference for referencing the controller server data in the two example projects?

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2478 posts

    Posted 15 Nov 2017 Link to this post

    Hello Erik,

    In both examples the data is passed directly to the Grid component. The difference is where the items are contained. In the first case they are available in the model and in the second case the items are in the ViewBag.

    With that said, the  Kendo MVC wrappers are not intended to work with WebForms. If you have a WebForms application I would recommend using our UI for ASP.NET AJAX controls. They are built specifically for working in WebForms applications. 


    Regards,
    Viktor Tachev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Erik
    Erik avatar
    42 posts
    Member since:
    Aug 2012

    Posted 15 Nov 2017 in reply to Viktor Tachev Link to this post

    Maybe I mispoke, I am using System.Web.Mvc.WebFormViewEngine instead of Razor.  I believe I should still be using 'UI for ASP.NET MVC' controls.  I have been thus far in my project.
  4. Erik
    Erik avatar
    42 posts
    Member since:
    Aug 2012

    Posted 15 Nov 2017 in reply to Erik Link to this post

    And a follow-up question on the server-hierarchy example project:

    What is the "item" referencing?  Is it related to entity framework? Or something else?

    .DetailTemplate(@<text>
            @(Html.Kendo().Grid(item.Products)
                  .Name(string.Format("product_grid_{0}", item.CategoryID)) // the Name() should be unique
                  .Columns(columns =>
                  {
                      columns.Bound(product => product.ProductID);
                      columns.Bound(product => product.ProductName);
                  })
                  .Pageable()
            )
          </text>)

     

    How does it "know" a property of Products and CategoryID?

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2478 posts

    Posted 17 Nov 2017 Link to this post

    Hi Erik,

    The item in the code snippet is referring to the dataItem of the parent row. Thus, all fields that are present in the parent row Model can be accessed.

    The parent row contains a field Products that is a collection. That is passed as the main data to the detail Grid. Since the name of each component should be unique the CategoryID is included in the name. This field is also available in the Category Model.


    Regards,
    Viktor Tachev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top