Hi
I'm trying to use the RadTreeView like this:
the treeView takes its data from a list.
When I press on a node, I get a value from it (& then later I can call function base on the value)
I have a hard time to set value into the treeView
I set the List like that:
vb.NET:
As you see, I insert a value,text,iD &parent_id into the RadTreeView, [line 77-80]
All is built well : the text,ID & Parent_id. But when I try to get the value field it shows me null:
p.s
I Must use the "Value" Property and not "by text" ,because I've identical text menu
I'm trying to use the RadTreeView like this:
the treeView takes its data from a list.
When I press on a node, I get a value from it (& then later I can call function base on the value)
I have a hard time to set value into the treeView
I set the List like that:
vb.NET:
01.
Friend
Class
SiteDataItem
02.
Private
text1
As
String
03.
Private
id1
As
Integer
04.
Private
parentId1
As
Integer
05.
Private
report_id1
As
String
06.
07.
Public
Property
Text()
As
String
08.
Get
09.
Return
text1
10.
End
Get
11.
Set
(
ByVal
value
As
String
)
12.
text1 = value
13.
End
Set
14.
End
Property
15.
16.
17.
Public
Property
ID()
As
Integer
18.
Get
19.
Return
id1
20.
End
Get
21.
Set
(
ByVal
value
As
Integer
)
22.
id1 = value
23.
End
Set
24.
End
Property
25.
26.
Public
Property
ParentID()
As
Integer
27.
Get
28.
Return
parentId1
29.
End
Get
30.
Set
(
ByVal
value
As
Integer
)
31.
parentId1 = value
32.
End
Set
33.
End
Property
34.
35.
Public
Property
Report_ID()
As
String
36.
Get
37.
Return
report_id1
38.
End
Get
39.
Set
(
ByVal
value
As
String
)
40.
report_id1 = value
41.
End
Set
42.
End
Property
43.
44.
Public
Sub
New
(
ByVal
id
As
Integer
,
ByVal
parentId
As
Integer
,
ByVal
text
As
String
,
Optional
ByVal
report_id1
As
String
=
"99"
)
45.
Me
.id1 = id
46.
Me
.parentId1 = parentId
47.
Me
.text1 = text
48.
Me
.report_id1 = Report_ID
49.
50.
End
Sub
51.
52.
53.
'--------- Constractor
54.
Public
Sub
New
(
ByVal
id
As
Integer
,
ByVal
parentId
As
Integer
,
ByVal
text
As
String
,
Optional
ByVal
report_id1
As
String
=
"99"
)
55.
Me
.id1 = id
56.
Me
.parentId1 = parentId
57.
Me
.text1 = text
58.
Me
.report_id1 = Report_ID
59.
60.
End
Sub
61.
End
Class
62.
63.
'=======
64.
65.
66.
Private
Sub
BindToIEnumerable(
ByVal
treeView
As
RadTreeView)
67.
Dim
siteData
As
New
List(Of SiteDataItem)()
68.
69.
siteData.Add(
New
SiteDataItem(1, 0,
"Location"
))
70.
siteData.Add(
New
SiteDataItem(2, 0,
"Hobbies"
))
71.
siteData.Add(
New
SiteDataItem(3, 1,
"func 1"
,
"101"
))
72.
siteData.Add(
New
SiteDataItem(4, 1,
"func 2"
,
"102"
))
73.
siteData.Add(
New
SiteDataItem(5, 2,
"func 4"
,
"103"
))
74.
siteData.Add(
New
SiteDataItem(6, 2,
" func 1"
,
"104"
))
75.
76.
77.
treeView.DataTextField =
"Text"
78.
treeView.DataFieldID =
"ID"
79.
treeView.DataFieldParentID =
"ParentID"
80.
treeView.DataValueField =
"Report_ID"
81.
treeView.DataSource = siteData
82.
treeView.DataBind()
83.
84.
85.
86.
End
Sub
As you see, I insert a value,text,iD &parent_id into the RadTreeView, [line 77-80]
All is built well : the text,ID & Parent_id. But when I try to get the value field it shows me null:
Protected
Sub
treeView_SideMenu_NodeClick(sender
As
Object
, e
As
RadTreeNodeEventArgs)
Handles
treeView_SideMenu.NodeClick
Session(
"funcID"
) = e.Node.Value
'Unfortunately return NULL
End
Sub
p.s
I Must use the "Value" Property and not "by text" ,because I've identical text menu