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

Collapse all and Expand all Button on the header of GridView

3 Answers 116 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 14 Apr 2011, 02:17 PM
Hi,

how do i achieve a PLUS and MINUS symbol on the header to collapse and expand all functionality on the RADGRIDVIEW. I am using the latest version.

Thanks,
Shiras

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 14 Apr 2011, 02:54 PM
Hi David,

 

May you provide a bit more details about your exact requirement? Do you need to change the expander button either in the GridViewGroupRow or the expand button in GridViewRow? Any additional information about the desired final result would be highly appreciated. Thus we would be able to provide you with an adequate solution. 


Kind regards,
Vanya Pavlova
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
0
Ravi
Top achievements
Rank 1
answered on 14 Apr 2011, 06:35 PM
On the header of the parent row grid, i will need a button which will help the user upon clicking will either collapse all the rows which are expanded nor expand all the rows which are collapsed.

but intention is to give an option to the user to expand all rows and collapse all rows on a single click, the user should not have to goto each row expand/collapse.

Hope this clears?

Thanks
0
Vanya Pavlova
Telerik team
answered on 15 Apr 2011, 08:48 AM
Hi David,

 

You can use ExpandAllHierarchyItems()/CollapseAllHierarchyItems() methods of RadGridView for hierarchy. Once you may get access to the GridViewToggleButton in you need to subscribe to the Checkec/UnChecked events of GridViewToggleButton and apply the appropriate logic:

private void RadGridView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
      {
          var row = e.Row as GridViewRow;
          if (row != null)
          {
              var toggleButton = row.ChildrenOfType<GridViewToggleButton>().FirstOrDefault();
              if (toggleButton != null)
              {
 
                //your code
              }
          }
      }

Best wishes,
Vanya Pavlova
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
Ravi
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Ravi
Top achievements
Rank 1
Share this question
or