An Extensive Examination of the DataGrid Web Control: Part 18

Posted by: 4GuysFromRolla.com Headlines, on 15 Jun 2005 | View original | Bookmarked: 0 time(s)

The DataGrid Web control includes a bevy of common features, such as paging, sorting, and row-by-row editing of the DataGrid's underlying data. We've discussed how to accomplish these tasks in previous installments of the An Extensive Examination of the DataGrid Web Control article series, first looking at creating a sortable DataGrid in Part 4. Unfortunately the DataGrid's built-in sorting only allows for uni-directional sorting. That is, when creating the DataGrid you must decide on a column-by-column basis if the data will be sorted in ascending or descending order.

While it's impressive the ease with which uni-directional sorting can be added to a DataGrid, ideally we'd like to offer bi-directional sorting. There are a couple of techniques that can be used to accomplish this end, one of which was discussed in Part 12 of this article series. Specifically, Part 12 showed how to dynamically adjust each DataGrid column's SortExpression property to toggle ascending or descending sorting. One downside of this approach, as Part 12 noted, was that you needed to hard-code in sortable column, mapping the SortExpression to the appropriate DataGridColumns index. This downside of this approach, then, is that it would need to be customized for each page that you wanted to use a bi-directional sortable DataGrid.

In this 18th part of the An Extensive Examination of the DataGrid Web Control article series we'll look at an alternative approach to implementing bi-directional sorting, one that doesn't require any hard-coded mapping and therefore can easily be reused. We'll also look at a simple method that will enhance the appearance of our bi-directional sortable DataGrid, adding little up and down arrows on the column header that the grid's data is sorted by. Read on to learn more! (If you are unfamiliar with creating a sortable DataGrid, please take a moment to first read Part 4 of this article series before continuing; if you have never created a bi-directional sortable DataGrid, be sure to read Part 12 before tackling this part.)
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: DataGrid | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1726 | Hits: 168

Similar Posts

  • Announcing the WebsiteSpark Program more
  • Announcing the Microsoft AJAX CDN more
  • Intersoft Solutions Announces WebUI Studio 2009 Service Pack 1 more
  • Building Interactive User Interfaces with Microsoft ASP.NET AJAX: Triggering Full Page Postbacks From An UpdatePanel more
  • ASP.NET MVC: DevExpress Mail Demo more
  • WebResource access in ASP.NET MVC more
  • ASP.NET Membership Tip: Requiring New Users To Change Their Password When Logging On For The First Time more
  • Using SSL in your application more
  • Silverlight 3 Released more
  • Telerik Introduces Free Web Testing Framework for ASP.NET AJAX and Silverlight 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