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

[Solved] Selecting Row on Expand RowDetails

1 Answer 219 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Meehir
Top achievements
Rank 1
Meehir asked on 03 Jan 2011, 03:28 PM
Hi,

I am using radgridview having GridViewToggleRowDetailsColumn. The row details of particular row is depended on that.  So if I select that row and then expand, I get the row details using SelectedItem property of radgridview.
But, when I select particular row (second row) and expand another row (third row), the SelectedItem property of radgridview contains value of second row.  Hence , the row details of 3rd row gives the value of second row, which is incorrect. 

I need some way or property or event with which I can get value of third rowitem (the row which we do expand).

Kindly provide me the solution to this.

Thanks in Advance

Regards,
Meehir Jha

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 03 Jan 2011, 03:41 PM
Hello Meehir,

Firstly, you may use the RowDetailsVisibilityChanged event of the grid. It will be fired each time the RowDetails are collapsed/ expanded and you may get the corresponding row using the arguments.
Another approach may be to select the item on clicking on the Toggle Button:

this.clubsGrid.AddHandler(GridViewToggleButton.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnMouseDown), true);
         
private void OnMouseDown(object sender, MouseButtonEventArgs e)
{
    RadGridView grid = sender as RadGridView;
    var buttons = grid.ChildrenOfType<GridViewToggleButton>();
    foreach (GridViewToggleButton button in buttons)
    {
        if(button.IsPressed)
        {
            GridViewRow parentRow = button.ParentOfType<GridViewRow>();
            if (parentRow != null)
            {
                parentRow.IsSelected = true;
            }
        }              
    }          
}


Kind regards,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Meehir
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or