Hello Guys
Im trying to create a simple Hierarchy in a RadGridView, but the RadGridView
is not making the relation, i mean, as you can see in the attached file,
even the relation is betweet columns Id_Report of the parent Template,
and Id_Report of the child template, is not making the match between them.
Can anyone tell me something about this behaivor pls?
Thanks for you Help
Cesar
Im trying to create a simple Hierarchy in a RadGridView, but the RadGridView
is not making the relation, i mean, as you can see in the attached file,
even the relation is betweet columns Id_Report of the parent Template,
and Id_Report of the child template, is not making the match between them.
Can anyone tell me something about this behaivor pls?
Dim
template
As
New
GridViewTemplate()
template.BeginUpdate()
template.DataSource =
Me
.oConsulta.Select_DS(
"56"
).Tables(0)
grReportsSolicitado.MasterTemplate.Templates.Add(template)
Dim
relation
As
New
GridViewRelation(grReportsSolicitado.MasterTemplate)
relation.ChildTemplate = template
relation.RelationName =
"Id_Report"
relation.ParentColumnNames.Add(
"Id_Report"
)
relation.ChildColumnNames.Add(
"Id_Report"
)
grReportsSolicitado.Relations.Add(relation)
template.EndUpdate()
Me
.grReportsSolicitado.EndUpdate()
Me
.grReportsSolicitado.Refresh()
Thanks for you Help
Cesar
5 Answers, 1 is accepted
0
Hi Cesar,
I tested the described scenario in RadGridView and I could not observe issues related with the loading operation. Please, could you send me a sample project where the issue can be reproduced. This will allow us to investigate the case in detail and to provide you with further assistance.
You can find more information about hierarchical binding in RadGridView in our online documentation.
I am looking forward to your reply.
All the best,
Julian Benkov
the Telerik team
I tested the described scenario in RadGridView and I could not observe issues related with the loading operation. Please, could you send me a sample project where the issue can be reproduced. This will allow us to investigate the case in detail and to provide you with further assistance.
You can find more information about hierarchical binding in RadGridView in our online documentation.
I am looking forward to your reply.
All the best,
Julian Benkov
the Telerik team
SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).
0

Cesar
Top achievements
Rank 1
answered on 25 Jan 2012, 04:41 PM
Hello Julian
Thanks for your answer, i'm attaching you a simple project where you can see the structure applied, and a image with the result, as you will see is not making the relation
thanks for your help
Cesar
Thanks for your answer, i'm attaching you a simple project where you can see the structure applied, and a image with the result, as you will see is not making the relation
thanks for your help
Cesar
Imports
Telerik.WinControls.UI
Imports
System.ComponentModel
Imports
System.Data.SqlClient
Public
Class
Form1
Public
Sql_Con
As
SqlConnection =
New
SqlConnection
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
grReportEstandar.AllowAddNewRow =
False
grReportEstandar.AllowColumnReorder =
False
grReportEstandar.AllowDeleteRow =
False
grReportEstandar.ShowFilteringRow =
False
grReportEstandar.ShowGroupedColumns =
False
grReportEstandar.ShowGroupPanel =
False
Me
.grReportEstandar.DataSource =
Me
.Select_DS(
"2"
).Tables.Item(0)
Me
.grReportEstandar.GroupDescriptors.Add(
"Nom_Modulo"
, ListSortDirection.Ascending)
Me
.grReportEstandar.SortDescriptors.Add(
"Nom_Modulo"
, ListSortDirection.Ascending)
'Me.grReportEstandar.Columns.Item("Id_Mod").IsVisible = False
'Me.grReportEstandar.Columns.Item("Sto_Proc").IsVisible = False
'Me.grReportEstandar.Columns.Item("Id_Report").IsVisible = False
'Me.grReportsSolicitado.Columns.Item("CrossTab").IsVisible = False
Me
.grReportEstandar.BestFitColumns()
Me
.grReportEstandar.Columns.Item(
"Nom_Report"
).Width = 200
Me
.grReportEstandar.Columns.Item(
"Nom_Report"
).HeaderText =
"Reporte"
For
a
As
Integer
= 0
To
grReportEstandar.RowCount - 1
Me
.grReportEstandar.Rows(a).Cells(
"Nom_Report"
).
ReadOnly
=
True
Next
Dim
template1
As
New
GridViewTemplate()
template1.BeginUpdate()
template1.AllowAddNewRow =
False
template1.AllowColumnReorder =
False
template1.AllowDeleteRow =
False
template1.ShowFilteringRow =
False
template1.ShowGroupedColumns =
False
template1.Columns.Add(
New
GridViewCheckBoxColumn(
"Visible"
))
template1.DataSource =
Me
.Select_DS(
"1"
).Tables(0)
template1.Columns.Item(
"Name"
).Width = 200
template1.Columns.Item(
"Name"
).HeaderText =
"Campo"
grReportEstandar.MasterTemplate.Templates.Add(template1)
Dim
relation1
As
New
GridViewRelation(grReportEstandar.MasterTemplate)
relation1.ChildTemplate = template1
relation1.RelationName =
"Id_Report"
relation1.ParentColumnNames.Add(
"Id_Report"
)
relation1.ChildColumnNames.Add(
"Id_Report"
)
grReportEstandar.Relations.Add(relation1)
template1.EndUpdate()
Me
.grReportEstandar.EndUpdate()
Me
.grReportEstandar.Refresh()
End
Sub
Public
Function
Select_DS(
ByVal
tipo
As
String
)
As
DataSet
Dim
query
As
String
=
""
Try
Me
.Sql_Con =
Me
.Check_Connection(
"BisynfDW"
)
If
(
Me
.Sql_Con.State = ConnectionState.Open)
Then
Dim
str2
As
String
= tipo
Select
Case
str2
Case
"1"
query =
"select ModId Id_Mod, RepId Id_Report, Campo, (select top 1 x.name from otra x where t.campo=x.word )name from OCAM t"
Case
"2"
query = (
"select distinct (select x.Nom_Modulo from Omod x where x.id_Modulo=f.Id_Mod)Nom_Modulo, f.Id_Mod, f.Id_Report, f.Nom_Report, f.Sto_Proc "
& _
"FROM Orep f "
& _
"where cast(f.Id_Report as nvarchar(2)) + '|' + cast(f.Id_Mod as nvarchar(2)) "
& _
" in ( select cast(x.repid as nvarchar(2)) + '|' + cast(x.modid as nvarchar(2))"
& _
" from RPPE x"
& _
" where x.companyid=1) "
& _
"order by f.Id_Mod,f.Nom_Report desc"
)
End
Select
End
If
Dim
set2
As
New
DataSet
Dim
adapter
As
New
SqlDataAdapter()
adapter.SelectCommand =
New
SqlCommand(query, Sql_Con)
adapter.Fill(set2)
Sql_Con.Close()
Sql_Con.Dispose()
Return
set2
Catch
ex
As
Exception
MsgBox(
"Error: "
& ex.Message &
" Class: Consultas, Metodo: Select_DS, Consulta: "
& query,
Nothing
)
Return
Nothing
End
Try
End
Function
Public
Function
Check_Connection(
ByVal
Bds
As
String
,
Optional
ByRef
Server
As
String
=
Nothing
,
Optional
ByRef
Usuario
As
String
=
Nothing
,
Optional
ByRef
Contra
As
String
=
Nothing
)
As
SqlConnection
If
(
Me
.Sql_Con.State = ConnectionState.Closed)
Then
Try
If
String
.IsNullOrEmpty(Server)
And
String
.IsNullOrEmpty(Usuario)
And
String
.IsNullOrEmpty(Contra)
Then
Me
.Sql_Con.ConnectionString =
String
.Concat(
New
String
() {
"Data Source=(local);Initial Catalog=BisynfDW;User ID=sa;Password=1234 ;Asynchronous Processing=True;"
})
Else
Me
.Sql_Con.ConnectionString =
String
.Concat(
New
String
() {
"Data Source="
, Server,
";Initial Catalog="
, Bds,
";User ID="
, Usuario,
";Password="
, Contra,
" ;Asynchronous Processing=True;"
})
End
If
Me
.Sql_Con.Open()
Return
Me
.Sql_Con
Catch
exception1
As
Exception
If
(exception1.Message =
"Error relacionado con la red o especifico de la instancia mientras se establec"
& ChrW(237) &
"a una conexión con el servidor SQL Server. No se encontr"
& ChrW(243) &
" el servidor o "
& ChrW(233) &
"ste no estaba accesible. Compruebe que el nombre de la instancia es correcto y que SQL Server est"
& ChrW(225) &
" configurado para admitir conexiones remotas. (provider: Proveedor de canalizaciones con nombre, error: 40 - No se pudo abrir una conexi"
& ChrW(243) &
"n con SQL Server)"
)
Then
Interaction.MsgBox(
"El Servicio de SQL Server se encuentra detenido, Inicie el Servicio y vuelva a intentar."
, MsgBoxStyle.Critical,
"Conexion SQL Server"
)
Else
MsgBox(
"Error: "
& exception1.Message &
" Class: Consultas, Metodo: Check_Connection "
,
Nothing
)
End
If
Me
.Sql_Con.Close()
Return
Nothing
End
Try
End
If
Sql_Con.Close()
Sql_Con.Dispose()
Dim
str2
As
String
= Bds
Me
.Sql_Con.ConnectionString =
String
.Concat(
New
String
() {
"Data Source=(local);Initial Catalog=BisynfDW;User ID=sa;Password=1234 ;Asynchronous Processing=True;"
})
Me
.Sql_Con.Open()
Return
Me
.Sql_Con
End
Function
End
Class
0
Hi Cesar,
In your case, all settings seem properly configured and everything should work without any issues considering the RadGridView hierarchy mode setup.
I made a review of your codebase and I think that the issue is related to the name of the key column 'Id_Report'. Please verify the name of the column the 'Id_Report' in the second DataTable used as a DataSource for the child GridViewTemplate. To test your data and sql queries, you can add a DataTable '1' and '2' to one DataSet and create a DataRelation between them:
After that you can use GetChildRows API of DataRow to verify the produced hierarchy data. More information on how to use DataRelations you can find in this MSDN article.
I hope this helps.
All the best,
Julian Benkov
the Telerik team
In your case, all settings seem properly configured and everything should work without any issues considering the RadGridView hierarchy mode setup.
I made a review of your codebase and I think that the issue is related to the name of the key column 'Id_Report'. Please verify the name of the column the 'Id_Report' in the second DataTable used as a DataSource for the child GridViewTemplate. To test your data and sql queries, you can add a DataTable '1' and '2' to one DataSet and create a DataRelation between them:
Private
Sub
CreateRelation()
' Get the DataColumn objects from two DataTable objects
' in a DataSet. Code to get the DataSet not shown here.
Dim
parentColumn
As
DataColumn = _
DataSet1.Tables(
"Customers"
).Columns(
"CustID"
)
Dim
childColumn
As
DataColumn = DataSet1.Tables( _
"Orders"
).Columns(
"CustID"
)
' Create DataRelation.
Dim
relCustOrder
As
DataRelation
relCustOrder =
New
DataRelation( _
"CustomersOrders"
, parentColumn, childColumn)
' Add the relation to the DataSet.
DataSet1.Relations.Add(relCustOrder)
End
Sub
After that you can use GetChildRows API of DataRow to verify the produced hierarchy data. More information on how to use DataRelations you can find in this MSDN article.
I hope this helps.
All the best,
Julian Benkov
the Telerik team
SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).
0

Cesar
Top achievements
Rank 1
answered on 01 Feb 2012, 06:13 PM
Hello Julian
Thanks for for help, i have checked all possible variables but i could not find the explain of this behaivor, i choose to work with the radtree
Regards
Thanks for for help, i have checked all possible variables but i could not find the explain of this behaivor, i choose to work with the radtree
Regards
0

Mariajo
Top achievements
Rank 1
answered on 07 Nov 2017, 02:54 PM
Hello, i have a report made with reporting Q3 2013 and VS 2012. When installing it on the client, it gives error 40: a connection with SQL could not be opened. The report in local is ok. that could be happening? other report in the same app are ok, with de same connection.
Thank you