Home Client side sorting on ASP.NET MVC WebGrid
Reply: 0

Client side sorting on ASP.NET MVC WebGrid

user978
1#
user978 Published in June 23, 2018, 7:59 am

I have a partial view which contain an MVC WebGrid as below

 <div id="grid">
            @{
                var grid = new WebGrid(source: Model.Items,
                                       defaultSort: "Name", 
                                       rowsPerPage: 100);


            }
            @grid.GetHtml(columns: grid.Columns(
                        grid.Column(columnName: "Name", header: "Name", canSort:true),
                        grid.Column(columnName: "Code", header: "Code")
                    ))
            </div>

This partial view is loaded using Jquery ajax call and result is inserted into a DIV in the main page.

The table render fine but my problem is that the sorting always generates a callback to the server. I want the sorting to happen at the client side only. Is it possible using WebGrid without using external datatables like jQuery datatable?

Thanks in advance

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306889 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO