Burepalli V S Rao
Top achievements
Rank 1
Burepalli V S Rao
asked on 31 May 2012, 02:54 PM
Hi Friends,
i want to deselect the telerik treeview node on form body click using javascript?
how to do that?
thanks,
Burepalli V S Rao.
i want to deselect the telerik treeview node on form body click using javascript?
how to do that?
thanks,
Burepalli V S Rao.
3 Answers, 1 is accepted
0
Hello,
Plamen Zdravkov
the Telerik team
You can use the unselectAllNodes function of the client object of RadTreeView when one clicks outside of it.
Hope this will help you.
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
SB
Top achievements
Rank 1
answered on 07 Jun 2012, 11:23 PM
Hi,
i want this only, but when i call this function like the below one
Thanks,
Burepalli V S Rao.
i want this only, but when i call this function like the below one
window.document.body.onclick = UnSelectAllNodes;
it is getting deselecting the nodes, but after that if i click on item then it has to select it, but it is not getting selected
Thanks,
Burepalli V S Rao.
0
Princy
Top achievements
Rank 2
answered on 08 Jun 2012, 08:48 AM
Hello Mohinder,
I have created a sample code based on your scenario. Please check the following code snippet.
aspx:
JS:
Thanks,
Princy.
I have created a sample code based on your scenario. Please check the following code snippet.
aspx:
<
form
id
=
"form1"
runat
=
"server"
onclick
=
"deselect();"
style
=
"background-color:Red;"
>
<
div
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
></
asp:ScriptManager
>
<
telerik:RadTreeView
ID
=
"RadTreeView1"
runat
=
"server"
OnClientNodeClicking
=
"OnClientNodeClicking"
>
<
Nodes
>
<
telerik:RadTreeNode
Text
=
"Node1"
></
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"Node2"
></
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"Node3"
></
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"Node4"
></
telerik:RadTreeNode
>
</
Nodes
>
</
telerik:RadTreeView
>
</
div
>
</
form
>
JS:
<script type=
"text/javascript"
>
var
i;
function
deselect() {
var
tree = $find(
"<%= RadTreeView1.ClientID%>"
);
if
(i != 0) {
tree.unselectAllNodes();
}
i = 1;
}
function
OnClientNodeClicking(sender, args) {
i = 0;
}
</script>
Thanks,
Princy.