Hi,
I have an unbound radgridview and i am trying to add some on-demand (unbound) hierarchical child/grid to it. It seems i have to "load data in the grid" twice to see data. The first time around, i get to see the columns in the master grid but no data. When i "load data in grid" again, i then get the data.
It seems that when the Master Gird is bound and then i create the on-demand child grid, i can see the data. I must be missing some step in the unbound mode and cannot figure out what. Please could you help?
My code (VS2008) is shown below. The issue is i have to click the Button1 twice to get data .
Thanks
Don
I have an unbound radgridview and i am trying to add some on-demand (unbound) hierarchical child/grid to it. It seems i have to "load data in the grid" twice to see data. The first time around, i get to see the columns in the master grid but no data. When i "load data in grid" again, i then get the data.
It seems that when the Master Gird is bound and then i create the on-demand child grid, i can see the data. I must be missing some step in the unbound mode and cannot figure out what. Please could you help?
My code (VS2008) is shown below. The issue is i have to click the Button1 twice to get data .
Thanks
Don
Imports
Telerik.WinControls.UI
Public
Class
Form1
Private
Sub
Button1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button1.Click
'clear all data (since we have to click twice to see the data)
gridReview.Columns.Clear()
gridReview.Rows.Clear()
'set up columns
gridReview.Columns.Add(
New
GridViewTextBoxColumn(
"ID"
))
gridReview.Columns.Add(
New
GridViewTextBoxColumn(
"Employee"
))
gridReview.Columns.Add(
New
GridViewTextBoxColumn(
"Code"
))
gridReview.Columns.Add(
New
GridViewTextBoxColumn(
"Total Hours"
))
gridReview.Columns.Add(
New
GridViewCheckBoxColumn(
"Review"
))
'setup some grid proerties
gridReview.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
gridReview.AllowAddNewRow =
False
gridReview.AllowDeleteRow =
False
gridReview.ShowGroupPanel =
False
gridReview.Columns(0).
ReadOnly
=
True
gridReview.Columns(1).
ReadOnly
=
True
gridReview.Columns(2).
ReadOnly
=
True
'load sample data
gridReview.Rows.Add(1111,
"John Smith"
, 423, 40.2,
False
)
gridReview.Rows.Add(2222,
"Jane Doe"
, 421, 10.2,
False
)
gridReview.Rows.Add(3333,
"Larry Smith"
, 423, 23.5,
False
)
gridReview.Rows.Add(4444,
"Lori Smith"
, 425, 26.1,
False
)
'create the hierarchical grid
Dim
template
As
New
GridViewTemplate()
'setup hierarchical grid columns
Dim
id
As
New
GridViewTextBoxColumn(
"ID"
)
Dim
shiftdate
As
New
GridViewTextBoxColumn(
"DisplayDate"
)
Dim
in1
As
New
GridViewTextBoxColumn(
"In1"
)
Dim
out1
As
New
GridViewTextBoxColumn(
"Out1"
)
Dim
hours
As
New
GridViewTextBoxColumn(
"Hours"
)
'setup some hierarchical grid properties
template.Columns.AddRange(id, shiftdate, in1, out1, hours)
template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
template.AllowAddNewRow =
False
template.AllowDeleteRow =
False
template.AllowEditRow =
False
gridReview.Templates.Add(template)
template.HierarchyDataProvider =
New
GridViewEventDataProvider(template)
'not specified relation as its on-demand.
'code will be put in gridReview_RowSourceNeeded
End
Sub
Private
Sub
Form1_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
AddHandler
gridReview.RowSourceNeeded,
AddressOf
gridReview_RowSourceNeeded
End
Sub
Private
Sub
gridReview_RowSourceNeeded(
ByVal
sender
As
Object
,
ByVal
e
As
GridViewRowSourceNeededEventArgs)
MessageBox.Show(
"Show some data"
)
End
Sub
End
Class