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

[Solved] How to hide self referenced rows in parent grid?

2 Answers 119 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.
Nick
Top achievements
Rank 1
Nick asked on 05 Nov 2010, 09:43 PM
Hello,

I am using self referencing functionality in RadGridView. I need to hide parent grid items that are related to other items within the grid..

for example:

Row1
   Row3
Row2
Row3   <-- I don't want this row to be present in parent

I am currently following the example and attaching RowLoaded event where I am changing the IsExpandable. I also tried to change Visibility or rows I would like to hide but this will leave white spots in the grid. I am thinking about changing row Heigth to 0. Is this the right approach or there is a better one?

Thanks,
Nick

private void dataGrid_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
       {
           GridViewRow row = e.Row as GridViewRow;
           DataGridRowData item = e.DataElement as DataGridRowData;
 
           if (row != null && item != null)
           {
               if (!item.HasParent)
               {
                   row.IsExpandable = true;
               }
               else
               {
                   row.IsExpandable = false;
                   // row. Visibility = Visibility.Collapsed  <-- will leave empty spots in the grid
               }
           }
 
       }

2 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 08 Nov 2010, 08:25 AM
Hello Nick,

May you take a look at this forum thread and let me know if it corresponds to your requirements ?
 

Sincerely yours,
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
0
Nick
Top achievements
Rank 1
answered on 08 Nov 2010, 06:20 PM
Hi Maya,

Thanks a lot! That workaround worked good for me.

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