GeekArticles
Database
SQL Server
Database
SQL ServerSorting a Grid of Data in ASP.NET MVC
<p>
Last article, <a a Grid of Data in ASP.NET MVC</a>, showed, step-by-step, how to display a
grid of data in an <a MVC</a> application. Last article started with creating a new ASP.NET MVC application in Visual Studio,
then added the Northwind database to the project and showed how to use Linq-to-SQL tool to access data from the database. The article then looked at creating
a Controller and View for displaying a list of product information (the Model).
</p><p>
This article builds on the demo application created in <i>Displaying a Grid of Data in ASP.NET MVC</i>, enhancing the grid to include bi-directional sorting.
If you come from an ASP.NET WebForms background, you know that the GridView control makes implementing sorting as easy as ticking a checkbox. Unfortunately, implementing
sorting in ASP.NET MVC involves a bit more work than simply checking a checkbox, but the quantity of work significantly greater and with ASP.NET MVC we have
more control over the grid and sorting layout and markup, as well as the mechanism through which sorting is implemented. With the GridView control, sorting
is handled through form postbacks with the sorting parameters - what column to sort by and whether to sort in ascending or descending order - being submitted as hidden
form fields. In this article use querystring parameters to indicate the sorting parameters, which means a particular sort order can be indexed by search engines,
bookmarked, emailed to a colleague, and so on - things that are not possible with the built-in sorting capabilities.
</p><p>
Like with its predecessor, this article offers step-by-step instructions and includes a complete, working demo available for download at the end of the article.
Read on to learn more!
<br /><a More ></a></p>
Sponsored Links
Read Next: Filtering a Grid of Data in ASP.NET MVC
Related Topics
Subscribe via RSS
SQL Server
- Naming Database Objects: Part II
- Trace Messages Part V: Trace Cleanup
- Naming Database Objects: Part I
- Multiple-Child Aggregation
- Creating SQL Tables for an Integrating Application Using Dexterity
- SQL Server 2005 Beta 2 Transact-SQL Enhancements
- .NET Rocks! - Brian Larson on SQL Server Reporting Services
- Computing the Trimmed Mean in SQL
- SQL Server 2000 Gains on Oracle
- Separator First Formatting (SFF)
