Grid MVC in a PartialView

2 posts, 1 answers
  1. Daniel
    Daniel avatar
    7 posts
    Member since:
    Jul 2016

    Posted 16 Jan 2017 Link to this post

    Hi,

    I am using a Grid MVC in a PartialView and when I try add a new record, the PartialView is rendered and obviously the page lost styles and scripts.
    How can I use all functionalities of a Grid MVC in a PartialView.

    This is my code.

    01.@(Html.Kendo().Grid(Model.RelatedCompanies)
    02.    .Name("Relatedcompanies")
    03.    .ToolBar(tools => tools.Create().Text("Agregar nuevo"))
    04.    .Columns(columns =>
    05.    {
    06.        columns.Bound(p => p.ThirdParties.NumIdentificationThirdParty);
    07.        columns.Bound(p => p.ThirdParties.BusinessName).ClientTemplate("#= ThirdParties.BusinessName #" +
    08.            "<input type='hidden' name='RelatedCompanies[#= index(data)#].ThirdParties.BusinessName' value='#= ThirdParties.BusinessName #' />"
    09.        );
    10.        columns.Bound(p => p.DescriptionRelatedCompany).ClientTemplate("#= DescriptionRelatedCompany #" +
    11.            "<input type='hidden' name='RelatedCompanies[#= index(data)#].DescriptionRelatedCompany' value='#= DescriptionRelatedCompany #' />"
    12.        );
    13.    })
    14.    .Events(events => events
    15.        .Change("relatedCompaniesOnChange")
    16.    )
    17.    .DataSource(dataSource => dataSource
    18.        .Server()
    19.        .Model(model =>
    20.        {
    21.            model.Id(p => p.Id);
    22.        })
    23.        .Create(update => update.Action("CreateCompany", "ThirdPartiesDef"))
    24.    )
    25.)
  2. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    2499 posts

    Posted 18 Jan 2017 Link to this post

    Hi Daniel,

    The Grid component should work as expected when you place it in a PartialView. Would you open the browser console by pressing F12 and see if there are any errors listed there?

    Also, would you describe how you are loading the PartialView? Is the behavior different when you place the Grid directly in theView?


    Regards,
    Viktor Tachev
    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.
Back to Top