Loading ...

Multiple column sorting in a gridview with template fields.

Who is online?  0 guests and 0 members
home  »  forums   »  codeasp.net community   »  3rd party controls   » Multiple column sorting in a gridview with template fields.

Multiple column sorting in a gridview with template fields.

Posts under the topic: Multiple column sorting in a gridview with template fields.

Posted: 6/16/2010

Lurker 10  points  Lurker
  • Joined on: 6/16/2010
  • Posts: 2

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


Posted: 6/16/2010

Professional 8495  points  Professional
  • Joined on: 5/3/2010
  • Posts: 389

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

Lurker 10  points  Lurker
  • Joined on: 6/16/2010
  • Posts: 2

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.

Thanks,

Annet


Posted: 6/17/2010

Professional 8495  points  Professional
  • Joined on: 5/3/2010
  • Posts: 389
  Answered

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.


Page 1 of 1 (4 items)