Converting Client Side binding to Server Side to improve performance

327 views Asked by At

I have a window that renders 5 Telerik grids using client side binding via AJAX calls to controller. Given that the data is not enough for a paging solution, I want to cut down the loading time of few of the grids, which at max reaches upto 2.5 seconds.

Following is the sample code for one of the grid which uses client-side binding:

<h4> EMP List</h4>
    @{
        Html.Telerik().Grid(Model.EMPList)
        .Name("gvEMPList")
        .DataKeys(keys =>
        {
            keys.Add(t => t.empID);
        })
        .Columns(columns =>
        {

            columns.Bound(s => s.EMPName).Title("NAME").ReadOnly().Width(150);

            columns.Bound(s => s.EMPType).Title("Type")
                 .ClientTemplate("<# if(EMPTypeIDOld==EMPTypeID)) { #> <#= EMPType #> <#} else { #> <span style='color:#929292'> [<#=EMPTypeOld #>] </span> <# } #>")
                 .ReadOnly().Width(350);
            if (ViewBag.EMP_Edit)
            {
                columns.Bound(s => s.empID).Title("Action").Width(230)
                         .ClientTemplate("<# if(empID <= 0) { #> <input type='button' class='t-button' value='Reject Salaray' onclick=\"gvSalaryRequest('<#= empID#>')\"/> <# } #>").ReadOnly();
            }

        })
        .DataBinding(dataBinding => dataBinding.Ajax()
            .Select("_SelectEMPToRequest", "Employee", new { DeptID = ViewBag.DeptID})
            )

        .Sortable()
            //.Scrollable(s => s.Height("auto"))
       .Resizable(r => r.Columns(true))
       .Reorderable(reorder => reorder.Columns(true))
       .ColumnContextMenu()
       .Render();
    }

The primary concern is of having as many AJAX calls as grids in the page.

Questions:

  • Should I consider Server-Side binding for this?
  • If yes, How do I achieve the same functionality as above? (e.g. clientTemplate, HTMLembedding, Custom command).
  • Is there any other solution to be considered?
1

There are 1 answers

0
Shoeb Siddique On

I am not sure about your view or requirement. But I had a similar issues and I used tab to overcome this. Users are not going to see all the grid at same time. So I'm getting data on tab activate.

If you can't use tab then server side grid is right way to go about it.