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

Self referencing grid

1 Answer 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tasos
Top achievements
Rank 1
Tasos asked on 16 Oct 2014, 05:01 AM
hi 
i have a grid and i want to avoid scrollbars to the childs when i open the tree. Can you help me?
My child table definitions are:

<telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition>

                    <telerik:GridViewTableDefinition.Relation>
                        <telerik:TableRelation IsSelfReference="True">
                            <telerik:TableRelation.FieldNames>
                                <telerik:FieldDescriptorNamePair ParentFieldDescriptorName="DocumentID" ChildFieldDescriptorName="BelongsTo"/>
                            </telerik:TableRelation.FieldNames>
                        </telerik:TableRelation>
                    </telerik:GridViewTableDefinition.Relation>
                    
                    <telerik:GridViewTableDefinition.ChildTableDefinitions>
                        <telerik:GridViewTableDefinition>

                            <telerik:GridViewTableDefinition.Relation>
                                <telerik:TableRelation IsSelfReference="True">
                                    <telerik:TableRelation.FieldNames>
                                        <telerik:FieldDescriptorNamePair ParentFieldDescriptorName="DocumentID" ChildFieldDescriptorName="BelongsTo"/>
                                    </telerik:TableRelation.FieldNames>
                                </telerik:TableRelation>
                            </telerik:GridViewTableDefinition.Relation>

                            <telerik:GridViewTableDefinition>
                                <telerik:GridViewTableDefinition>

                                    <telerik:GridViewTableDefinition.Relation>
                                        <telerik:TableRelation IsSelfReference="True">
                                            <telerik:TableRelation.FieldNames>
                                                <telerik:FieldDescriptorNamePair ParentFieldDescriptorName="DocumentID" ChildFieldDescriptorName="BelongsTo"/>
                                            </telerik:TableRelation.FieldNames>
                                        </telerik:TableRelation>
                                    </telerik:GridViewTableDefinition.Relation>

                                </telerik:GridViewTableDefinition>

                            </telerik:GridViewTableDefinition>

                        </telerik:GridViewTableDefinition>

                    </telerik:GridViewTableDefinition.ChildTableDefinitions>
                    
                </telerik:GridViewTableDefinition>
            </telerik:RadGridView.ChildTableDefinitions>

1 Answer, 1 is accepted

Sort by
0
Accepted
Boris
Telerik team
answered on 20 Oct 2014, 11:23 AM
Hi Tasos,

A possible way to go about this issue is to try setting the child grids height to auto. This should eliminate the need to show a vertical ScrollBar. For example you can use the DataLoading event of RadGridView as follows:

void clubsGrid_DataLoading(object sender, GridViewDataLoadingEventArgs e)
{
       var childGrids = this.clubsGrid.ChildrenOfType<RadGridView>();
  
       foreach (var gridView in childGrids)
       {
           gridView.MaxHeight = double.MaxValue;
           gridView.Height = double.NaN;
       }
}

I hope this helps.

Regards,
Boris Penev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Tasos
Top achievements
Rank 1
Answers by
Boris
Telerik team
Share this question
or