Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Sort by two columns in grid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sehboo - 01 Sep 2007 01:24 GMT
I have three columns in grid, name, division and terminal.  What I
want is that when I click on name header then I want the grid to sort
by name, but when I click on division then it should sort by division,
and then name.  This way, all the poeple in each division will be
sorted in alphabatical order.  How do I achieve this?  I am on VS2003.

Thanks
Eliyahu Goldin - 02 Sep 2007 08:55 GMT
You can specify both columns in the SortExpression property and override
DataGrid.OnSortCommand method. If only one column name is passed in the Sort
Expression property of the event argument, call the default event handler.
If two columns are passed, implement your own sorting. You may re-populate
the datasource with a modified sql or use a DataView that allows specifying
multiple columns for sorting.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>I have three columns in grid, name, division and terminal.  What I
> want is that when I click on name header then I want the grid to sort
[quoted text clipped - 3 lines]
>
> Thanks

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.