Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
230
WebGrid Sorting Problem
posted

If there are more than 1000 rows displying in a WebGrid(most of the columns are string type) then sorting that grid on any column is taking too much of time to display the records again.

We do not want to apply the pagination on the grid. Please provide any solution on this.

Thanks,

IH 

  • 28464
    Suggested Answer
    posted

    Hello,

    It really depends where and how you are sorting the data. Are you sorting on the client, on the server, or with Ajax. Are you using UpdatePanel?

    I can suggest experimenting with all of these options, including SortCaseSensitive and SortingAlgorithms property, and see how this affects sorting.

    Performance depends on how many rows and columns you're sorting.  A client-side sort is performed using JavaScript, which can be much slower than doing the same sort on the server.

    For a low amount of data, the difference is minimal, and it's often better to avoid the postback by doing the sort on the client.

    Once the amount of data gets larger (the "breakoff point" being different from client-machine-to-client-machine and application-to-application), the client-side sort becomes much mroe inefficient.

    You might want to consider using AJAX to perform the sort on the server while minimizing the impact to the user experience.  If you turn on the grid's built-in AJAX capabilities, tellling the grid to sort "on client" utilizes that AJAX functionality, and presents what is likely the best solution.  You might alternately put the grid inside a WebAsyncRefreshPanel or an UpdatePanel, either of which will turn the postback generated by a server-side sort into an AJAX callback instead.