Click here to Skip to main content
15,390,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a web page that renders Kendo grids within 2 partial views. The top grid contains orders with an outstanding balance for the customer. And the bottom grid contains paid off (zero balance) orders for the same customer. If an order from either grid is clicked on, the user can see the details for the order. We store all orders to session.orders.

The problem we have is that on some occasions, the request for the zero balance orders completes first and overwrites the non-zero orders, and when the user selects a non-zero order to view details an error is thrown.

Is there a way I can prioritize the Ajax calls to make sure the non-zero finishes first?

If not, is there a way I can control the partial views, so the zero view doesn't load until the non-zero is completed? Each view makes its own Ajax call, so sequencing the partial views will also have the effect of setting the priority for the Ajax calls.
Updated 16-Apr-14 9:47am

1 solution

On GridTwo set the AutoBind to false, for example

        .Events(events => events.DataBound("onG2DataBound"))
    .DataSource(dataSource => dataSource   
            .Read(read => read.Action("MyGridTwoListAjax", controller))
        .Filter(filters => { filters.Add(c => c.MyField).IsEqualTo(0); })
    .AutoBind(false)  </myclass>

Then perform a fetch in the databound event for GridOne

function onG1DataBound() {
    var gridTwo = $("#MyGridTWO").data("kendoGrid");
    if(gridTwo != null)

The autobind false tells grid 2 to wait on binding its data. Placing the fetch of grid 2 data in the databound of grid 1 lets us know we have data in the 1st grid before we fetch data for the 2nd grid.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900