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 SiteDataItem02. Private text1 As String03. Private id1 As Integer04. Private parentId1 As Integer05. Private report_id1 As String06. 07. Public Property Text() As String08. Get09. Return text110. End Get11. Set(ByVal value As String)12. text1 = value13. End Set14. End Property15. 16. 17. Public Property ID() As Integer18. Get19. Return id120. End Get21. Set(ByVal value As Integer)22. id1 = value23. End Set24. End Property25. 26. Public Property ParentID() As Integer27. Get28. Return parentId129. End Get30. Set(ByVal value As Integer)31. parentId1 = value32. End Set33. End Property34. 35. Public Property Report_ID() As String36. Get37. Return report_id138. End Get39. Set(ByVal value As String)40. report_id1 = value41. End Set42. End Property43. 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 = id46. Me.parentId1 = parentId47. Me.text1 = text48. Me.report_id1 = Report_ID49. 50. End Sub51. 52. 53. '--------- Constractor54. 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 = id56. Me.parentId1 = parentId57. Me.text1 = text58. Me.report_id1 = Report_ID59. 60. End Sub61. End Class62. 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 = siteData82. treeView.DataBind()83. 84. 85. 86. End SubAs 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 Subp.s
I Must use the "Value" Property and not "by text" ,because I've identical text menu