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

Can you force columns to stay together?

3 Answers 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Maria
Top achievements
Rank 1
Maria asked on 04 Oct 2011, 03:52 PM
Hello,

I would like to know if there is a way to link two columns together and force them to stay next to each other even if the user reorders other columns in the grid?

(Note: I am aware of freezing and disallowing the user from reordering columns, but this is not what I'm looking for)

Let's say I have a grid with columns 1,2,3,4. Columns 2 and 3 are closely related, and I would like them to stay together. So, if the user grabs column 2 and tries to put it as the first column, the new order would actually be 2,3,1,4, not 2,1,3,4.

Thanks.

Maria

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 05 Oct 2011, 12:23 PM
Hi Maria,

This is not present as an internal feature in RadGridview. However you can easily handle this scenario.
What you need to do is :

1. Know when the user tries to reorder columns - for this you can use the RowReordered and RowReordering events.

2. Take care to adjust the order (inside the event handler ) , by simply setting the DisplayIndex property of the column .

Best wishes,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jennifer
Top achievements
Rank 1
answered on 13 Oct 2011, 07:59 AM

I have a similar requirement. can you please provide a working example how can we achieve certain columns to stay together when a column is reordered with the reordered column?

Thanks in advance
0
Vlad
Telerik team
answered on 18 Oct 2011, 07:43 AM
Hello,

 We are about to release our Q3 2011 Beta (before the end of this week) and in this version we've added new RadGridView feature called merged column headers. Please wait for the beta and let us know if this will help in your scenario. 

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Maria
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Jennifer
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or