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

Select an item in Hierarchical gridview

1 Answer 124 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Angshuman
Top achievements
Rank 2
Angshuman asked on 03 Feb 2011, 01:55 PM
Please let me know how I can:

1. Programmatically select an item in a Hierarchical gridview. I want to select items both from the inner and the outer grids.

2. If an item (in the outer grid ) is not in the visible range and it has been expanded programmatically, how I can bring it up in the visible range.

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 03 Feb 2011, 03:14 PM
Hello Angshuman,

1. You need to get the child grid and set its SelectedItem property:

private void Button2_Click(object sender, RoutedEventArgs e)
        {
            if(this.clubsGrid.SelectedItem != null)
            {
                var selectedRow = this.clubsGrid.ItemContainerGenerator.ContainerFromItem(this.clubsGrid.SelectedItem) as GridViewRow;
                var childGrid = selectedRow.ChildrenOfType<GridViewDataControl>().FirstOrDefault();
                if(childGrid != null)
                {
                    childGrid.SelectedItem = childGrid.Items[1];
                }
            }      
        }

2.  You may take a look at this article for a reference.

 

Best wishes,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Angshuman
Top achievements
Rank 2
Answers by
Maya
Telerik team
Share this question
or