Geek Articles

Categories

 

Subscribe

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

 
GeekArticles Database SQL Server

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

Author: aspnet.4guysfromrolla.com | Published: 17th Jan 2008 | Visited: 38 times | Add Comment
Filed in: SQL Server

When binding data to a GridView using a data source control, enabling sorting is as simple as ticking the "Enable Sorting" checkbox in the GridView's Smart Tag. Enabling sorting turns each GridView column's header into a LinkButton that, when clicked, causes a postback and re-binds the data to the GridView, sorting it by the clicked column. Likewise, enabling sorting in the ListView is a fairly simple and straightforward process and can be accomplished without writing a line of code. The main challenge with enabling sorting in the ListView control is that there are no pre-defined columns, like with the GridView. Therefore, we are on the hook for defining and implementing the sorting interface. But once this is setup, the ListView can internally handle the sorting logic without the need for us to write any additional code. Of course, in more advanced scenarios we may need to manually sort the data or programmatically specify the sort expression used to internally sort the data. Prior to sorting, the ListView raises its Sorting event handler, which is an ideal place to add any additional sort-related logic. Moreover, the ListView control's sorting logic can be programmatically invoked via its Sort method. In this article we will look at how to enabling sorting in the ListView control. We will look at using the ListView's simple, baked in sorting functionality. Following that, we will see how to programmatically invoke this sorting logic via the Sort method as well as more advanced scenarios. Read on to learn more! Read More >

Read Article
 

Sponsored Links

 


Related Articles

 Speeding Up Data Submission The goal of building an Ajax based application is to ensure that interactivity of the site to the user is highly optimized. One of the main features of Ajax is to create an application that should predict what the user actually needs. As the user key in a letter the application will communicate to t ...

 Swing Extreme Testing - The Data Validation Test The Data Validation Test The Ok button of the SaveAsDialog should only be enabled if the name that has been entered is valid. A name can be invalid if it contains an illegal character, or if it has already been use ...

 Retrieving XML Data Retrieving XML DataTo retrieve XML data from an XMLType table, you can use a SELECT SQL statement, just as you would if you had to query a relational table. For example, to select the employee with the id set to 100 from the employees XMLType table discussed in the preceding section, you might issue ...

 Querying Data with Oracle XQuery Querying Data with Oracle XQuery Starting with Oracle Database 10g Release 2, you can take advantage of a full-featured native XQuery engine integrated with the database. With Oracle XQuery, you can accomplish various tasks involved in developing PHP/Oracle XML applications, operating on any kind of ...

 Breaking up XML into Relational Data Breaking up XML into Relational Data While the preceding example shows how to construct an XML representation over relational data, the example in this section illustrates how you can shred XML data back into relational data. This reverse operation can be useful if your application works with relati ...

 Binding the Enum to the Dropdown Listbox and Sorting it on Values. An article on Binding Enum to DropdownListbox with the SortedList that sort entries by value instead of by ...

 Accessing and Updating Data in ASP.NET 2.0: Using Optimistic Concurrency  Because multiple users can visit the same web page concurrently, it is possible for a user visiting a data modification page to inadvertently overwrite the modifications made by another user. Consider a page with an editable GridView. If two users visit this page simultaneously from different compu ...

 Moving Toward WPF Data Binding One Step at a Time A gradual introduction to the world of WPF data bin ...

 Custom controls with MonoDevelop and Gtk# Movable controls with customized rendering on Linux with ...

 .NET Building Blocks: Custom User Control Fundamentals Find out the gritty details required to create, test, use, inherit, install, and distribute .NET User Controls of all ty ...



Next: Two Common Pitfalls When Submitting a Web Form Using the Enter Key



Post Comment

Name:


Email:
 (Optional. Used for Notification)

Title:

 
Comment:


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





Latest Articles

 

Popular Articles

Sponsored Links