Problem with selecting a group of rows.

2 posts, 0 answers
  1. Adam
    Adam avatar
    1 posts
    Member since:
    Jul 2013

    Posted 04 Jul 2013 Link to this post


    I've got some problem with RadGridView.
    I want select all rows in one group of records. 
    The problem is when I select whole group by clicking one of the record, the
    whole group is selected correctly, but when I click one row twice only one
    of the rows from the group is selected. It's made programmability by own
    method, is there any event that selects and deselect whole group, can you
    give me some advice how to make it programmability? 

  2. Dimitar
    Dimitar avatar
    2983 posts

    Posted 09 Jul 2013 Link to this post

    Hello Adam,

    Thank you for writing.

    I am not sure that I have understood your scenario, and especially how you are selecting whole group by a single click. I have prepared a demo project where you can select the entire group and the group will remain selected when you click a row in it. 
    In the demo I am using the CurrentRowChanged to select the rows in the group like this:
    void radGridView1_CurrentRowChanged(object sender, Telerik.WinControls.UI.CurrentRowChangedEventArgs e)
        if (radGridView1.Columns["col3"].IsGrouped)
            foreach (var row in radGridView1.Rows)
                if ( e.CurrentRow!=null && e.CurrentRow.Cells[2].Value == row.Cells[2].Value)
                    row.IsCurrent = true;
                    row.IsCurrent = false;

    Also the selection needs to be cleared when the rows are no longer grouped. We can do this in the GroupByChanging event:
    void radGridView1_GroupByChanging(object sender, Telerik.WinControls.UI.GridViewCollectionChangingEventArgs e
        foreach (var row in radGridView1.Rows)
            row.IsCurrent = false;
    If the demo does not fit in your case, please provide me with more detailed information about what you need to accomplish.

    I am looking forward to your reply.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top