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

Client side sorting on ASP.NET MVC WebGrid

user7161
1#
user7161 Published in September 20, 2018, 1:27 pm

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

share|improve this question
  • see this.. Razor webgrid ajax paging and sorting – Mortalus Jan 31 '13 at 3:23
  • Thanks for the response. But I dont want to do an AJAX sorting as well.. I want the complete sorting to happen in Javascript – Srijit Jan 31 '13 at 3:36
  • Thanks for the reply. Could you please post the reply as "Answer" so that I can give you credit. – Srijit Jan 31 '13 at 3:52

2 Answers 2

active oldest votes
up vote 2 down vote accepted
You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO