Can you force columns to stay together?

4 posts, 1 answers
  1. Maria
    Maria avatar
    11 posts
    Member since:
    Nov 2010

    Posted 04 Oct 2011 Link to this post

    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
  2. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 05 Oct 2011 Link to this post

    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 >>

  3. Jennifer
    Jennifer avatar
    1 posts
    Member since:
    Jul 2010

    Posted 13 Oct 2011 Link to this post


    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
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 18 Oct 2011 Link to this post

    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 >>

Back to Top