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

Hide Expand-Button

1 Answer 92 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Johann
Top achievements
Rank 1
Johann asked on 15 Nov 2011, 10:40 AM
Hi,

i have a GridView with Hierarchy.

1.How can i hide the expand Button.
2.How can i expand with the SelectChanged-Event. And i need the information from the Selected Row.

In your Forum i found a older Solution, but it wont work with the actual Telerik-Build.

Thank you

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 15 Nov 2011, 11:36 AM
Hello Johann,

You can subscibe to the SelectionChangedEvent of the GridView and do what you need in the handler. 

void gridView_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            foreach (var item in e.RemovedItems)
            {
                var row = this.gridView.ItemContainerGenerator.ContainerFromItem(item) as GridViewRow;
 
                if(row != null)
                {
                    row.IsExpandable = false;
                    row.IsExpanded = false;
                     
                }
            }
 
            foreach (var item in e.AddedItems)
            {
                var row = this.gridView.ItemContainerGenerator.ContainerFromItem(item) as GridViewRow;
 
                if(row != null)
                {
                    row.IsExpandable = true;
                    row.IsExpanded = true;
                     
                }
            }
        }

However I suggest you look at this example. I believe that this is actually better choice for the desired functionality. All the best,
Nikolay Vasilev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Johann
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or