Paging & Sorting grids with ASP.Net MVC -


I am new to MVC, and I'm not indexed how you will paging and sort on the grid. I am using the ASP.NET grid view control with our object data source, which indicates the objects in our business layer - and in that case the ODS all paging & amp; Sort by using the methods that we generate on our Orum object.

I have used the same ORM with MVC - and things work fine there - I just create a table through the collection of loop pages - but without the ODS to control paging for; Sorting, how am I confused that how do I handle it? Will I have a different controller for paging and sorting?

I think I need to roll my roll - but where do I start? I've created a client controller, and a scene that displays a table of customers that looks down - and I want to sort them in FirstName or the last column. My model has a sort () method, which will take a string sort expression in the format that will be used by a Gridview / ODS pair, will I take a new action on sorting my client controller, and will have an application for my header?

  & lt; Table & gt; & Lt; TR & gt; & Lt; Th & gt; First name & lt; / Th & gt; & Lt; Th & gt; Last name & lt; / Th & gt; & Lt; / TR & gt; & Lt;% foreach (Miscellaneous items in the model) {%> & Lt; TR & gt; & Lt; TD & gt; & Lt;% = Html.Encode (item first name)% & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt;% = HTML.Encode (item.LastName)% & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt;%}% & gt; & Lt; / Table & gt; You can use the same controller, just add an extra parameter and name it. Then check in the controller what sort of sort, and sort your data based on that parameter. 

Or if you want to work on the client side, you can use something like a plugin for JavaScript. / P>


Comments