Answered by:
Sort the Column header in ListView (ascending and descending order)

Question
-
I want to sort the column header in my listview. There are multiple columns exists in listview.
Once I click on column header then it will sort in ascending order then again I click on the same column header then it should be sort in descending order.
Any help will be appreciated.
Regards Ashlesh,Saturday, April 25, 2009 10:09 AM
Answers
-
http://support.microsoft.com/kb/319401
Thanks, A.m.a.L | [Remember to click "mark as answered" when you get a correct reply to your question]- Proposed as answer by Kira Qian Tuesday, April 28, 2009 2:39 AM
- Marked as answer by Ashlesh Patel Tuesday, April 28, 2009 8:16 AM
Saturday, April 25, 2009 10:25 AM -
Hi Ashlesh Patel,
Currently ListView doesn't support to auto sort rows base on the column click while DataGridView support. If you use DataGridView, you can click each column's header to sort ascending or descending. But if you use ListView, you'd to write these code to implement the sort function. That's what the article for.
Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.- Marked as answer by Ashlesh Patel Tuesday, April 28, 2009 8:15 AM
Tuesday, April 28, 2009 2:39 AM
All replies
-
http://support.microsoft.com/kb/319401
Thanks, A.m.a.L | [Remember to click "mark as answered" when you get a correct reply to your question]- Proposed as answer by Kira Qian Tuesday, April 28, 2009 2:39 AM
- Marked as answer by Ashlesh Patel Tuesday, April 28, 2009 8:16 AM
Saturday, April 25, 2009 10:25 AM -
Hi,
Thanks for the reply.
It is really needful to me.
But I want to know that, is this possible by setting any property value of ListView's column header?
To accomplish it, Do I need to do this much coding?
Is there any short way to sort column in ListView?
Thanks.
Regards Ashlesh,Saturday, April 25, 2009 10:52 AM -
Hi Ashlesh Patel,
Currently ListView doesn't support to auto sort rows base on the column click while DataGridView support. If you use DataGridView, you can click each column's header to sort ascending or descending. But if you use ListView, you'd to write these code to implement the sort function. That's what the article for.
Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.- Marked as answer by Ashlesh Patel Tuesday, April 28, 2009 8:15 AM
Tuesday, April 28, 2009 2:39 AM -
Hi Kira Qian,
Thanks for the information.
Let me try to implement this snippet. Then I will get back to you.
Regards Ashlesh,Tuesday, April 28, 2009 8:16 AM