Completed
Last Updated: 26 Jun 2015 08:56 by ADMIN
ADMIN
Julian Benkov
Created on: 07 Mar 2012 03:42
Category: GridView
Type: Bug Report
2
FIX. RadGridView - unbound hierarchy mode with 3-level relation throws exception
http://www.telerik.com/forums/gridview---adding-a-third-hierarchy-or-level#HdPZFtCJR0q1OCXxVR5wjg

Dim ID As New GridViewDecimalColumn()
ID.Name = "ID"
ID.HeaderText = "Id"
RadGridView1.MasterTemplate.Columns.Add(ID)
 
Dim Name As New GridViewTextBoxColumn()
Name.Name = "Name"
Name.HeaderText = "Name"
Name.Width = 100
RadGridView1.MasterTemplate.Columns.Add(Name)
 
Dim Under_Appeal As New GridViewCheckBoxColumn()
Under_Appeal.DataType = GetType(Boolean)
Under_Appeal.Name = "Under_Appeal"
Under_Appeal.HeaderText = "Under Appeal"
RadGridView1.MasterTemplate.Columns.Add(Under_Appeal)
 
Dim Terminated As New GridViewCheckBoxColumn()
Terminated.DataType = GetType(Boolean)
Terminated.Name = "Terminated"
Terminated.HeaderText = "Terminated"
RadGridView1.MasterTemplate.Columns.Add(Terminated)
 
Dim Hash As New GridViewDecimalColumn()
Hash.Name = "Hash"
Hash.HeaderText = "#"
RadGridView1.MasterTemplate.Columns.Add(Hash)
 
 
RadGridView1.Rows.Add(1, "John", True, True)
RadGridView1.Rows.Add(2, "Mary", True, False)
RadGridView1.Rows.Add(3, "Peter", False, True)
 
 
Dim template As New GridViewTemplate
template.Columns.Add(New GridViewDecimalColumn("ParentID"))
template.Columns.Add(New GridViewTextBoxColumn("TEXT"))
template.Columns.Add(New GridViewDecimalColumn("PRICE"))
 
RadGridView1.MasterTemplate.Templates.Add(template)
 
Dim relation As New GridViewRelation(RadGridView1.MasterTemplate)
relation.ChildTemplate = template
relation.RelationName = "PersonProduct"
relation.ParentColumnNames.Add("ID")
relation.ChildColumnNames.Add("ParentID")
RadGridView1.Relations.Add(relation)
 
 
template.Rows.Add(1, "sugar", 2.0)
template.Rows.Add(1, "cake", 12.0)
template.Rows.Add(1, "butter", 3.0)
template.Rows.Add(2, "cake", 12.0)
 
 
Dim template2 As New GridViewTemplate
template2.Columns.Add(New GridViewDecimalColumn("ParentID2"))
template2.Columns.Add(New GridViewTextBoxColumn("TYPE"))
template2.Columns.Add(New GridViewDecimalColumn("QTY"))
 
RadGridView1.MasterTemplate.Templates(0).Templates.Add(template2)
 
Dim relation2 As New GridViewRelation(RadGridView1.MasterTemplate.Templates(0))
relation2.ChildTemplate = template2
relation2.RelationName = "PersonProduct2"
relation2.ParentColumnNames.Add("ParentID")
relation2.ChildColumnNames.Add("ParentID2")
RadGridView1.Relations.Add(relation2)
 
 
template2.Rows.Add(1, "brown", 1)
template2.Rows.Add(1, "whiter", 3)
template2.Rows.Add(2, "banana", 2)

I am getting errors at runtime when I try to see the 3rd level in the hyerarchy.
0 comments