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

Sort Order of Group Headers

3 Answers 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 14 Aug 2009, 03:12 PM
I've got a set of entities I'm bidning to the grid that are in a specific order in the collection.

When I do grouping however, they groups are ordered alphabetically.

For example:

Name = "Joe"  Amount = 50
Name = "Jill" Amount = 75
Name = "Jill" Amount = 80
Name = "Deduction" Amount = "100"
name = "Deduction" Amount = "200"

When I bind it to the grid, they show up in order.
When I group by Name however, I see:

Deduction
  100
   200
Jill
   75
   80
Joe
   50


It's important that I have them in the order they were in the collection.  The entites in the colleciton could be given an "order number" if I have to do so, but I need to be sure i can sort the groups accordingly.

Do you have any suggestions for doing this?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 17 Aug 2009, 07:24 AM
Hi Michael,

Yes, you can add a hidden column that contains the row id. Then sort by this column and the order will be preserved. Here is a sample:

this.radGridView1.Columns.Add(new GridViewDecimalColumn("ID")); 
this.radGridView1.Columns["ID"].SortOrder = RadSortOrder.Ascending; 
this.radGridView1.Columns["ID"].IsVisible = false;                 
 

I hope this helps. Should you have any questions, don' t hesitate to ask.

Best wishes,
Jack
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
Smitha Test
Top achievements
Rank 1
answered on 16 Apr 2010, 07:29 PM
Did this actually work.

Because it did not work for me


the result i got was

Deduction
ID 
7    
8
9
Jill
ID
1
2
3
Joe
ID
4
5

But i want deduction in the end....Any other suggestions
0
Jack
Telerik team
answered on 19 Apr 2010, 04:44 PM
Hello Smitha Test,

Yes, this code should do the job. However, you have to add a hidden column that indicates the row order. You should sort by this column.

Please describe in detail the expected behavior and send me your application. I will try to find a proper solution. I am looking forward to your reply.

All the best,
Jack
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
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Jack
Telerik team
Smitha Test
Top achievements
Rank 1
Share this question
or