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

[Solved] Unselect HierarchyItem rows

1 Answer 136 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.
Jurjen Ladenius
Top achievements
Rank 2
Jurjen Ladenius asked on 27 Jun 2011, 11:03 AM
Hi,

I'm trying to programmatically unselecting rows in a hierarchy item of a row in my grid. 

I've defined my hierarchy as:
 <telerik:RadGridView.ChildTableDefinitions>
                        <telerik:GridViewTableDefinition>
                            <telerik:GridViewTableDefinition.Relation>
                                <telerik:PropertyRelation ParentPropertyName="Successor" />
                            </telerik:GridViewTableDefinition.Relation>
                        </telerik:GridViewTableDefinition>
                    </telerik:RadGridView.ChildTableDefinitions>

I can expand/collapse using myGrid.CollapseHierarchyItem, but I cannot do myGrid.Unselect(dataItem), nor can I find any method to retrieve hierarchyitem rows.

How can I either find the rows (not data!) associated with the hierarchy item, or unselect the rows?

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 27 Jun 2011, 02:01 PM
Hello Jurjen Ladenius,

In order to deselect the items in the child grids, you need firstly to find them. You may do the following:

var rows = this.clubsGrid.ChildrenOfType<GridViewRow>();
            foreach(GridViewRow row in rows)
            {
                var childGrid = row.ChildrenOfType<GridViewDataControl>().FirstOrDefault();
                if(childGrid != null)
                {
                    childGrid.UnselectAll();
                }
 
            }

However, this will be valid approach if the rows and the child grids are visible, i.e. created. Once you find the child control, you may find its rows as shown above. 
I am sending you a sample project illustrating the suggested approach. Please take a look at it and let me know whether it corresponds to your requirements.
  Regards,
Maya
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
Jurjen Ladenius
Top achievements
Rank 2
Answers by
Maya
Telerik team
Share this question
or