Hello,
im testing Telerik at the moment and come to an issue. I've searched your whole site for my problem, but i cant find any answer.
I'm trying to bind a hierarchical DataGrid to SQL, but i dont want to use TableAdapters. Instead of it i want to relaize it with a DataReader or something like that.
So my DataGrid loads the data very well, but when i try to make a template/relation nothing happens. There are still just the rows from the Parent, but the child data is missing. I've tried different ways with datasets, to refresh the DataGrid and many more, but nothing works. When i bind it to TableAdapters, it is working well! So here is my code - hope you can help me out...
Greets,
Shaggy
im testing Telerik at the moment and come to an issue. I've searched your whole site for my problem, but i cant find any answer.
I'm trying to bind a hierarchical DataGrid to SQL, but i dont want to use TableAdapters. Instead of it i want to relaize it with a DataReader or something like that.
So my DataGrid loads the data very well, but when i try to make a template/relation nothing happens. There are still just the rows from the Parent, but the child data is missing. I've tried different ways with datasets, to refresh the DataGrid and many more, but nothing works. When i bind it to TableAdapters, it is working well! So here is my code - hope you can help me out...
Private
Sub
FrmKundenliste_Load(sender
As
Object
, e
As
EventArgs)
Handles
MyBase
.Load
Dim
objconn
As
New
SqlConnection(My.Settings.SQL_V4)
Dim
rs
As
New
SqlCommand(
""
, objconn)
Dim
dr
As
DbDataReader
rs.CommandText = "Select * from dbo.ApplicationMain"
Try
objconn.Open()
dr = rs.ExecuteReader
If
dr.Read()
Then
RadGridView1.DataSource = dr
Dim
objconn_detail
As
New
SqlConnection(My.Settings.SQL_V4)
Dim
rs_detail
As
New
SqlCommand(
""
, objconn_detail)
Dim
dr_detail
As
DbDataReader
objconn_detail.Open()
rs_detail.CommandText =
"Select * from dbo.ApplicationDetail"
dr_detail = rs_detail.ExecuteReader
If
dr_detail.Read()
Then
Dim
template
As
New
GridViewTemplate()
template.DataSource = dr_detail
RadGridView1.MasterTemplate.Templates.Add(template)
Dim
relation
As
New
GridViewRelation(RadGridView1.MasterTemplate)
relation.ChildTemplate = template
relation.RelationName =
"ApplicationDetails"
relation.ParentColumnNames.Add(
"Id"
)
relation.ChildColumnNames.Add(
"ApplicationId"
)
RadGridView1.Relations.Add(relation)
End
If
End
If
Catch
ex
As
Exception
End
Try
End
Sub
Greets,
Shaggy