Geek Articles

Categories

 

Subscribe

Daily Updates Subscribe geekarticles update via email Subscribe geekarticles update via RSS

 
GeekArticles Database SQL Server

Extending the GridView to Include Sort Arrows

Author: aspnet.4guysfromrolla.com | Published: 23rd Jan 2008 | Visited: 115 times | Add Comment
Filed in: SQL Server

Before ASP.NET version 2.0 was released, I wrote a book and dozens of articles on the DataGrid control, which was the most functional data Web control in the ASP.NET 1.x toolbox. While the DataGrid still exists in ASP.NET 2.0, the GridView control serves as a much more functional and feature-rich choice. The GridView can be bound to data source controls like the SqlDataSource and ObjectDataSource, and paging, sorting, editing, and deleting can be implemented without having to write a single line of code. While the DataGrid (and GridView) offer built-in sorting support, there is no visual feedback as to what column the data is sorted by. In Part 18 of the An Extensive Examination of the DataGrid Web Control article series, I showed how to dynamically update a sortable DataGrid's header columns so that an up or down arrow image would appear next to the sorted column name depending on whether the column was sorted ascendingly or descendingly (view a live demo). This was accomplished by programmatically looping through the DataGrid's Columns collection and adding the up or down arrow image to column whose SortExpression value matched the DataGrid's SortExpression. I recently needed to implement this functionality in a GridView control. Rather than adding this code to an ASP.NET page, like I did with the DataGrid demo, I decided to instead create a custom Web server control that extended the GridView control, adding the necessary functionality. In this article we will look at the steps for building such a custom control as well as how to use the control in an ASP.NET page. The custom control's complete source code and a demo application are available for download at the end of this article. Read on to learn more! Read More >

Read Article
 

Sponsored Links

 


Related Articles

 Simple (non-JS) GridView Delete Confirmation A simple server-side solution for displaying a confirmation message upon Deleting an item in a Grid ...

 Scrollable Gridview with Freeze header and sort image. this is an easy way to get Freeze GridView header and add image sort. And it works on IE,Firefox and Others. work inside and outside of updatepa ...

 ListView Header Sort Direction Indicators Writing an ASP.NET Custom Control which extends the ListView to visually show sort direction for colu ...

 Improving the GridView sorting capabilities with Google Analytics features Improve the column sorting of the ASP.NET GridView to give the user a better visual experience. Highlight the column selected for sorting and include an image to indicate whether the sorting order is ascending or descend ...

 Hover Effects To The GridView Rows Using The CSS This article describes how to apply hover effects on the GridView rows using ...

 Expanding / Collapsing GridView Rows This article describes how to expand and collapse rows of a GridView using JavaScr ...

 GridView Custom Paging with PageSize Change Dropdown A GridView control with custom pag ...

 XML: Include a Flexible Parser in Your C++ Applications Free, portable, compiler-independent XML library in ...

 GridView Rows Navigation Using Arrow (Up/Down) Keys. This article describes how to navigate GridView rows with the help of arrow (up/down) keys using JavaScr ...

 CheckBox ComboBox Extending the ComboBox Class and Its Items An article on a CheckBox ComboBox control which extends the ComboBox.It ...



Next: Using ASP.NET 3.5's ListView and DataPager Controls: Sorting Data with the ListView Control



Post Comment

Name:


Email:
 (Optional. Used for Notification)

Title:

 
Comment:


Validation Code:
 <=>  (Enter this code in text box)





Latest Articles

 

Popular Articles

Sponsored Links