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

Determine Current Row When Row Details Is Selected

2 Answers 107 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 15 Jul 2010, 07:19 PM
Hi,

It seems that the GridView doesn't update the SelectedItem if for example, say you only expand the row, and then put focus on a control within the row details template, then the GridView doesn't change the SelectedItem property to the row whose row details has focus.

You first have to click the row, then expand the row to see the row details, and then put focus on a control within the row details template. Then the SelectedItem property of the GridView is in synch...

Am I missing something or is this how the GridView is supposed to behave?

Thanks,

Carlos

2 Answers, 1 is accepted

Sort by
0
Daniel Billingsley
Top achievements
Rank 1
answered on 15 Jul 2010, 07:36 PM
My understanding is that it's a rather significant limitation of the Telerik grid.

At least, I've experienced the same thing regarding clicking on a button that I've placed in a row.  This code in the button's click handler gets the row selected.  You could maybe use something similar when your control gets focus.  I'm not using the row details functionality, so it might not work the same for you.

GridViewRow row = (sender as UIElement).ParentOfType<GridViewRow>();
MyGrid.SelectedItem = row.Item;













0
Milan
Telerik team
answered on 16 Jul 2010, 06:03 AM

Hi Carlos,

You could easily force the selection of the parent row when row details are expanded by using our RowDetailsVisibilityChange event:

// subscribe for RowDetailsVisibilityChanged event
private void gridView_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
{
    if (e.Visibility == Visibility.Visible)
    {
        e.Row.IsSelected = true;
    }
}



Regards,
Milan
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
Carlos
Top achievements
Rank 1
Answers by
Daniel Billingsley
Top achievements
Rank 1
Milan
Telerik team
Share this question
or