Posted: 6/16/2010
Hi all,
I have a gridview whose columns are template fields. How can i sort the data in the gridview using multiple columns.
Thanks,
Annet
Hi Annet,
Please check the following article: http://www.highoncoding.com/ArticleDetails.aspx?articleID=176 which will help you understanding how you can implement manual sorting to a GridView.
Regards,Hajan
Posted: 6/17/2010
Hi Hajan,
Thanks for the reply. But what i wanted to achieve is to sort the data in a gridview using more than one column.
I had created a sort table which contains 3 checkboxes which have to point to the three column in a gridview/database.
My gridview is being populated by a an sql view. So, when a user checks a checkbox, then data in the gridview will be sorted by the selected columns. I don't want to achieve this by clicking on the gridview headers.
In the link I have provided on my previous post, you can see some custom methods that can be used for your scenario too. Of course, you will need to modify some things depending of your logic and maybe create another custom function that will handle the logic of sorting using checked checkboxes.
Another way (slower but easier for you) might be using custom made StoredProcedure that will check which checkBoxes are checked as input parameters of the SP and will do ORDER BY selected checkBoxes. Also it depends of how you fill the GridView with data and such stuff.