by Andrew Fenster and Boguslaw WojcieszykDESCRIPTION:We will describe a GridView sorting method we used in recent projects. Each GridView column can be sorted in ascending or descending order. An arrow indicates which column is being sorted, and in which direction.We're going to describe a GridView sorting method we used many times in recent projects. Here are two images which show what it looks like. In the first image, the first column (UserName) is sorted in ascending order. There is an arrow pointing up to indicate the sort column and sort direction.In the second image, the second column (Name) is sorted in descending order. Again, the arrow indicates the sort column and direction. We can sort any column by clicking on the header. We can reverse the sort direction by clicking again. The arrow shows which column is being sorted and in which direction.The code to create this grid is in the attached project. The best way to understand how it works is to download the project and run it. Here's a brief explanation:The MarkupHere is the markup for the GridView. Each column includes a HeaderTemplate. The HeaderTemplate contains a LinkButton. A LinkButton is a button that looks like a hyperlink. We set Font-Underline=False, so the links look like plain text, but that is a matter of preference. The important thing to understand is that the header for every column looks like text, but is really a button. When the button gets clicked, the gridUsers_Sort method gets called.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: