Improving the Sort Arrows GridView Control

Posted by: 4GuysFromRolla.com Headlines, on 06 Feb 2008 | View original | Bookmarked: 0 time(s)

While the GridView control offer built-in, bi-directional sorting support, there is no visual feedback as to what column the data is sorted by. To remedy this shortcoming, I showed how to create a custom server control that extended the GridView class and automatically added arrow up and down images to the appropriate column header, thereby clearly showing what column the data was sorted by and whether the data was sorted in ascending or descending order. Read Extending the GridView to Include Sort Arrows for more information on this technique.

A down arrow image is shown in the Price column because the data is sorted in descending order, by price.

Since publishing that article, I have received a lot of great feedback and suggestions for improving the control. 4Guys reader Richard Deeming proposed a better technique for adding the arrow images to the appropriate GridView header cell, one that removed the hacks that my approach required. Another great suggestion came from Tom Mason, who proposed using a differing CSS class in lieu of <img> elements in the header. Tom's ideas prompted me to add two new properties to the custom GridView control: SortAscendingStyle and SortDescendingStyle. Use these properties to customize the appearance of the sorted header cell.

Read on to learn more about these enhancements!
Read More >

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: GridView | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 2330 | Hits: 57

Similar Posts

  • VS 2010 Code Intellisense Improvements (VS 2010 and .NET 4.0 Series) more
  • Gaia Ajax 3.6 Beta Released! Free download of new Ajax GridView, 35++ Ajax Components and 100++ New Samples more
  • Gaia Ajax 3.6 Alpha released: Ajax GridView and Adaptive Rendering ++ more
  • Multiple child views with RadGridView for WinForms more
  • Silverlight Release History : Q2 2009 (version 2009.2.701) more
  • WPF Release History : Q2 2009 (version 2009.2.701) more
  • Going Controller-less in MVC: The Way Fowler Meant It To Be more
  • CodeDigest.Com Article,Codes,FAQs - April,2009 more
  • WPF Release History : Q1 2009 SP2 (version 2009.1.526) more
  • Silverlight Release History : Q1 2009 SP2 (version 2009.1.526) more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD