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

Issue Trying To Run 3-Level Hierarchy

3 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ben Thompson
Top achievements
Rank 1
Ben Thompson asked on 10 Dec 2010, 10:17 AM
Hi I am trying to run a routine that is to show three levels of hierarchy thus:-

Main Level RadGridView ('rgvInletDetails')       CylinderID, some fields.....        Bound to 'Inlet' Table
Second Level Template   ('CylTemplate')          CylinderID, some fields ........    Bound to 'Cylinders' table
Third Level Template     ('CylGasTemplate')      CylinderID, some fields .......     Bound to 'CylinderGas' table 

My routine to accomplish this is as follows:-
======================================================================

 

Dim CylRelation                 As GridViewRelation
Dim CylGasRelation          As GridViewRelation
Dim CylTemplate               As GridViewTemplate
Dim CylGasTemplate        As GridViewTemplate

 

 

 

'setup the master template
rgvInletDetails.MasterTemplate.Columns.Clear
rgvInletDetails.MasterTemplate.AddNewRowPosition = SystemRowPosition.Top
rgvInletDetails.MasterTemplate.AllowAddNewRow     =
True
PopInletDetails(rgvInletDetails)                                  '  Binding Source for rgvInletDetails.DataSource =  'Inlet' table 

 

 

 

'setup the Cylinder child template (Level 2)
CylTemplate                                          = New GridViewTemplate()
CylTemplate.Caption                           =
"Cylinders"
CylTemplate.AllowAddNewRow      = True
PopCylinderData(CylTemplate)                                                                'setup BindingSource for level 2 with 'Cylinder' table
rgvInletDetails.MasterTemplate.Templates.Add(CylTemplate)         ' add 2nd Level Template to MasterTemplates

 

 

 

'setup the CylinderGas child template (Level 3)
CylGasTemplate                                     = New GridViewTemplate()
CylGasTemplate.Caption                      =
"Cylinder Gas"
CylGasTemplate.AllowAddNewRow = True
PopCylinderGas(CylGasTemplate)                                                         'setup BindingSource for level 3 with 'CylinderGas' table
rgvInletDetails.MasterTemplate.Templates.Add(CylGasTemplate)  ' add 3rd Level Template to MasterTemplates

'create the Cylinder relation
Cylrelation                                            = New GridViewRelation(rgvInletDetails.MasterTemplate)
CylRelation.ParentTemplate              = rgvInletDetails.MasterTemplate
Cylrelation.ChildTemplate                 = CylTemplate
Cylrelation.RelationName                  =
"Cylinders"
Cylrelation.ParentColumnNames.Add("CylinderID")
Cylrelation.ChildColumnNames.Add(
"CylinderID")
rgvInletDetails.Relations.Add(Cylrelation)

 

 

 

'create the CylinderGas relation
CylGasRelation                                   = New GridViewRelation(rgvInletDetails.MasterTemplate)
CylGasRelation.ParentTemplate      = CylTemplate
CylGasRelation.ChildTemplate        = CylGasTemplate
CylGasRelation.RelationName         =
"CylinderGas"
CylGasRelation.ParentColumnNames.Add("CylinderID")
CylGasRelation.ChildColumnNames.Add(
"CylinderID")
rgvInletDetails.Relations.Add(CylGasRelation)

================================================================

Ok - all done. Now when I run this the main grid is displayed correctly with a '+' showing there are records for the 2nd level. However, when I click on
that '+' button then I get this message:-

(see attachment 'errordisplay.jpg' )

Actually an example of a three level hierarchy would be invaluable as it isn't immediately clear on the set up for this arrangement. This requirement above is further complicated by the fact that both Relations have to specify the same field name and I was worried in case the grid thought that it might have to produce two Level 2 grids rather than a Level 2 and a Level 3. As it is I probably have this incorrectly specified. But it would be really nice if an example of both arrangements could be provided.

Many thanks for taking the time to read this and if there are any other details I can provide please ask.
I am using this in a VB.Net 2.0 VS2008 IDE for Windows Forms and the RadgridView is from the 2010.3.10.1109 release.


Does anyone in Telerik know what the message "measure override returned positive infinity" actually means? Can't find any trace of it on the Internet.

 

 

 

 

 

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 11 Dec 2010, 08:46 AM
Hello,

The problem is here
rgvInletDetails.MasterTemplate.Templates.Add(CylGasTemplate)
you are adding the second level template to the master template and you should have added it to the first level template, like:
CylTemplate.Templates.Add(CylGasTemplate)

And another thing, when you create a relation, the parameter provided in the constructor is the parent template, you have fixed that problem on the second line with assigning a different parent template, but for future reference you can just add the parent template in the constructor and assign just the child template, so basically,
this:
CylGasRelation                                   = New GridViewRelation(rgvInletDetails.MasterTemplate)
CylGasRelation.ParentTemplate      = CylTemplate
CylGasRelation.ChildTemplate        = CylGasTemplate

should be
CylGasRelation = New GridViewRelation(CylTemplate)
CylGasRelation.ChildTemplate = CylGasTemplate

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 11 Dec 2010, 08:46 AM
Hello,

The problem is here
rgvInletDetails.MasterTemplate.Templates.Add(CylGasTemplate)
you are adding the second level template to the master template and you should have added it to the first level template, like:
CylTemplate.Templates.Add(CylGasTemplate)

And another thing, when you create a relation, the parameter provided in the constructor is the parent template, you have fixed that problem on the second line with assigning a different parent template, but for future reference you can just add the parent template in the constructor and assign just the child template, so basically,
this:
CylGasRelation                                   = New GridViewRelation(rgvInletDetails.MasterTemplate)
CylGasRelation.ParentTemplate      = CylTemplate
CylGasRelation.ChildTemplate        = CylGasTemplate

should be
CylGasRelation = New GridViewRelation(CylTemplate)
CylGasRelation.ChildTemplate = CylGasTemplate

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Ben Thompson
Top achievements
Rank 1
answered on 12 Dec 2010, 10:59 AM
Many thanks Emanuel Varga - that seems to have nailed it. [Still wondering what that peculiar error message actually meant ??]



Tags
GridView
Asked by
Ben Thompson
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Ben Thompson
Top achievements
Rank 1
Share this question
or