Partial View with Kendo Grid

2 posts, 0 answers
  1. Leya
    Leya avatar
    4 posts
    Member since:
    Feb 2015

    Posted 16 Feb 2015 Link to this post

    Hi Team,



    I have two kendo grids in two partial views.  This is being called in my
    Index.chtml . I have set the ServerOperation(false) however when i
    click the sort column, the partial view is opening in new window. 



    I would need the grid to be sorted in client side and the partial view should display inside the main view itself



    Please find the below code for one partial view

    Partial View

    =========

    @using Resources.Home

    @model IEnumerable<PackageModel>

    @(Html.Kendo().Grid(Model)

                      .Name("Grid")             

                      .Columns(columns =>

                      {

                          columns.Bound(c => c.ClientName);                    

                          columns.Bound(c => c.Status).Template(

                            @<text>

                                <div style="width: 98%; background-color:
    #fff; height: 5px; border: 1px solid #808080; float:
    left;margin-bottom:10px;">

                                    <div style="width: @( item.Status)%;
    height: 5px; background-color: @(
    item.StatusColor);">                                    

                                    </div>                              

                                    <div style="float: left;">@( item.StatusValue)</div>

                                </div>

                            </text>);                  

                          columns.Bound(c =>
    c.Vacancies).Template(@<text><img src='~/Assets/images/@(
    item.VacancyColor).png' /></text>).HtmlAttributes(new { style =
    "text-align:-webkit-center;" });

                          columns.Command(command => command.Custom("
    Edit").Click("showDetails").HtmlAttributes(new { @class = "fa
    fa-pencil-square-o" })).Title(@HomeResources.Edit_Properties);

                          columns.Command(command =>
    command.Custom(string.Empty).Click("showDetails").HtmlAttributes(new {
    @class = "fa fa-pencil-square-o" })).Title(@HomeResources.Planning);

                      })

                             .Sortable()

                                  .DataSource(source => source

                                      .Ajax()

                                      .ServerOperation(false)))





    Part of Index.cshtml

    ==========

          <div id="ActiveWorkPackage">

                @{ Html.RenderAction("ViewActiveWorkPackages", "Home"); }  // Action and controller for the partial view grid data

            </div>



    Controller

    ========

     public ActionResult ViewActiveWorkPackages()

            {

                IEnumerable<WorkPackageModel> packages = _workPackageService.GetWorkPackageDetails();

                return this.PartialView(

                   "_ActiveWorkPackageView", packages);

            }
  2. Leya
    Leya avatar
    4 posts
    Member since:
    Feb 2015

    Posted 17 Feb 2015 in reply to Leya Link to this post

    I have found the problem, It was because I have the following code in place

    .DataSource(source => source

                                      .Ajax()

                                      .ServerOperation(false)

    I have removed it and it worked like charm.
Back to Top