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

[Solved] RadGrid Sorting Issue

5 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wai Chiu Lau
Top achievements
Rank 1
Wai Chiu Lau asked on 10 Mar 2008, 11:25 AM
Hi,

I have a problem when sorting template columns containing fields that are objects.

I have custom collection ContactList with ContactInfo objects. One of the property of ContactInfo is Owner which is an object of type OwnerType. This object has ToString() method so the column is filled with the data, so that is no problem. When I sort this column the grid just goes blank!

I would really appreciate help.

Tahir

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 10 Mar 2008, 11:29 AM
Hi Tahir ,

How the grid is bound in your case? Do you use NeedDataSource or ObjectDataSource?

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Wai Chiu Lau
Top achievements
Rank 1
answered on 10 Mar 2008, 10:31 PM
Hi,

Thanks for your reply. I am not using either. I use something like:

gvw.DataSource = ContactList.Load().List
gvw.DataBind()

Tahir
0
Vlad
Telerik team
answered on 11 Mar 2008, 07:17 AM
Hello Tahir,

Automatic sorting can be achieved only with advanced data-binding otherwise you should handle SortCommand, provide DataSource and DataBind() the grid again exaclty in the same way as with MS DataGrid or MS GridView. More info you can find here:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/SimpleBinding/DefaultCS.aspx
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/NeedDataSource/DefaultCS.aspx

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Wai Chiu Lau
Top achievements
Rank 1
answered on 11 Mar 2008, 09:41 AM
Hello Vlad,

Yes I am doing exactly that, handling the SortCommand event and providing DataSource and calling DataBind(). For simple columns it works fine however for a column (property of object) that is a custom object/class, then it fails.

Tahir
0
Ves
Telerik team
answered on 14 Mar 2008, 09:21 AM
Hi Wai Chiu Lau,

You can switch to Advanced Databinding. Please, find an example of RadGrid bound to sub-objects here.

Kind regards,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Wai Chiu Lau
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Wai Chiu Lau
Top achievements
Rank 1
Ves
Telerik team
Share this question
or