3 Answers, 1 is accepted
0
Hello Kjell,
You can programmatically subscribe to the OnNodeDataBound event of the embedded TreeView and set the Enabled property based on the node's data item:
Regards,
Peter Milchev
Progress Telerik
You can programmatically subscribe to the OnNodeDataBound event of the embedded TreeView and set the Enabled property based on the node's data item:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
RadDropDownTree1.EmbeddedTree.NodeDataBound += EmbeddedTree_NodeDataBound;
// other code here ...
}
}
private
void
EmbeddedTree_NodeDataBound(
object
sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
{
// use data item data instead
if
(e.Node.Text ==
"World Continents"
)
{
e.Node.Enabled =
false
;
}
}
Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Kjell
Top achievements
Rank 1
Iron
answered on 27 Feb 2019, 11:00 PM
Is not that example for telerik:RadTreeView?
I use telerik:RadDropDownTree
Protected Sub RadDropDownTree1_NodeDataBound(sender As Object, e As Telerik.Web.UI.DropDownTreeNodeDataBoundEventArguments)
End Sub
0
Hello Kjell,
Yes, the article is for the TreeView but the DropDownTree uses the TreeView control to show the tree in the dropdown. Also, the NodeDataBound of the DropDownTree does not have the properties as the TreeView's node and that is why I suggest adding the handler for the embedded TreeView's event.
For VB, you can use the following code to attach the handler in the Page_Load event:
Regards,
Peter Milchev
Progress Telerik
Yes, the article is for the TreeView but the DropDownTree uses the TreeView control to show the tree in the dropdown. Also, the NodeDataBound of the DropDownTree does not have the properties as the TreeView's node and that is why I suggest adding the handler for the embedded TreeView's event.
For VB, you can use the following code to attach the handler in the Page_Load event:
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
Me
.Load
If
Not
IsPostBack
Then
AddHandler
RadDropDownTree1.EmbeddedTree.NodeDataBound,
AddressOf
EmbeddedTree_NodeDataBound
End
If
End
Sub
Private
Sub
EmbeddedTree_NodeDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.RadTreeNodeEventArgs)
If
e.Node.Text =
"World Continents"
Then
e.Node.Enabled =
False
End
If
End
Sub
Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.