This is a migrated thread and some comments may be shown as answers.

sorting a listview like a grid

6 Answers 120 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 15 Jun 2011, 06:44 PM
I have looked at the basic sorting example but I would prefer not to have the sort mechanism be triggered from controls outside of the listview. I have my listview set up to mimic the look and feel of a RadGrid using the predefined layout for grids. Is there any way to set up the sorting such that users can simply click on the headers in my listview (and also show the up/down arrow) to initiate the sorting process? I would like the sorting of my listview to be exactly like this. Is this possible?

6 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 21 Jun 2011, 09:02 AM
Hello Dave,

You could try adding a link button inside the <th> elements of the LayoutTemplate and handle their server Click event. There, you could fire a sort command for the listview :
Firing command events from code

Best wishes,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Dave
Top achievements
Rank 1
answered on 12 Jul 2011, 09:27 PM
I followed your advice, but the sorting wasn't working. I was banging my head against a wall until I decided to check the latest internal build and I noticed that the internal build for 7/1 mentions a bug fix for the listview ("FIX RadListView sorting issue when paging is enabled and the listview is bound to an EntityFramework context through NeedDataSource event "). Sure enough, I turned off paging and now the sorting is working. So, the question is: when is the next official release of the radcontrols for asp.net ajax going to be released? I'd rather not use an internal build in my production environment.
0
Tsvetina
Telerik team
answered on 13 Jul 2011, 04:32 PM
Hello Dave,

As you have probably already seen, Q2 2011 has just been release. You can download it from your account and test your project against it. Let us know if you notice any other issues with this functionality.

All the best,
Tsvetina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Dave
Top achievements
Rank 1
answered on 13 Jul 2011, 07:04 PM
The sorting is working well now in my radlistview. Thank you. I am using the FireCommandEvent method.
0
Dave
Top achievements
Rank 1
answered on 20 Jul 2011, 02:33 PM
Is there any way that I can add an up/down arrow and change the background color of the column currently being sorted on in my radlistview (just like the RadGrid does)?
0
Maria Ilieva
Telerik team
answered on 25 Jul 2011, 11:26 AM
Hi Dave,

Note that RadListView is build by templates and you could put whatever images you want in this templates. In order to show images in the current sorted column you could show this images conditionally based on the sort expression on the server for example. Please see the following demo which presents how you could add image in the RadListView templates:
http://demos.telerik.com/aspnet-ajax/listview/examples/sorting/customsorting/defaultcs.aspx

Kind regards,
Maria Ilieva
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
ListView
Asked by
Dave
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Dave
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or