Self referencing grid

2 posts, 1 answers
  1. Tasos
    Tasos avatar
    9 posts
    Member since:
    Dec 2012

    Posted 16 Oct 2014 Link to this post

    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>
  2. Answer
    Boris
    Admin
    Boris avatar
    276 posts

    Posted 20 Oct 2014 Link to this post

    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.

     
Back to Top