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

[Solved] Sorting grid

7 Answers 181 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gagan Garg
Top achievements
Rank 1
Gagan Garg asked on 10 Jul 2009, 08:13 AM
Hi Guys

I have a radgrid bind with object datasource.
I want to implement sorting on grid columns.but in rad grid automatic sorting is implemented only when the grid is bind with datatables or dataview.

Please provide me a sample which have a grid sort on client side and bind with object datasource.

Its very urgent.

Thanks in advance.

7 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 13 Jul 2009, 02:18 PM
Hello Gagan,

You can use paging, sorting, filtering and other advanced RadGrid functionality with any bindable data source you specify for RadGrid, including the ObjectDataSource.

You can go through the following help article to get acquainted with the approach of setting up the data source control declaratively.

Best wishes,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rod
Top achievements
Rank 1
answered on 11 Sep 2009, 03:14 PM
I am also using an object datasource and everytime I try to sort I get a page error saying the datasource does not support sorting. Only DataTable and DataViews are supported?

Help

Rod
0
Vlad
Telerik team
answered on 14 Sep 2009, 06:20 AM
Rodney,

You will get the same with standard MS GridView unless you implement sorting for your ObjectDataSource! In RadGrid you can set OverrideDataSourceControlSorting to true and the grid will sort instead ObjectDataSource.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jo
Top achievements
Rank 1
answered on 01 Mar 2010, 10:46 AM
hi

i am also facing the same problem...my data is pointing to Microsoft dyanamics CRM..in demo aricle its explaing depeding on sql database ..please let me know if the data is coming from CRM..i need to apply sorting like ascending order when the page loads..
the data will display in ascending order...

thanks in advance
0
Veli
Telerik team
answered on 01 Mar 2010, 04:48 PM
Hello kolluru,

If the CRM you are using comes with a data source control (like SqlDataSource) and you are binding RadGrid through it, then sorting is performed by the data source control if the latter supports it. If not, RadGrid sorts the data. If you are feeding the data to RadGrid through its NeedDataSource event, then RadGrid implements sorting internally, unless you decide to implement custom sorting and provide your custom sorting logic in RadGrid's SortCommand  event.

Best wishes,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jo
Top achievements
Rank 1
answered on 05 Mar 2010, 09:03 AM
Hi veli

the help article is not helped for me..(sorry to say like this)..i am successed to implement the filters on the radgrid...my problem is in the radgrid table i have three columns like "company name", "noof employees","regstration no"..when the page loads these three columens and correspondind data will display..i implemented filters on those ..they are fine..my requirement is when the page loads the "company name" will display on "ascending" order (like alphabatical order ) ...the data is feeding to radgrid is from data source (CRM)....is there any sample code ..please let me know asap..

thanks
0
Veli
Telerik team
answered on 05 Mar 2010, 12:58 PM
Hello Jo,

If you need to load a grid column initially sorted, you need to add a sort expression to the MasterTableView. You can do this on Page_Load:

GridSortExpression expr = new GridSortExpression();
expr.FieldName = "Name";
expr.SortOrder = GridSortOrder.Descending;
RadGrid1.MasterTableView.SortExpressions.AddSortExpression(expr);


Kind regards,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Gagan Garg
Top achievements
Rank 1
Answers by
Veli
Telerik team
Rod
Top achievements
Rank 1
Vlad
Telerik team
Jo
Top achievements
Rank 1
Share this question
or