Hi,
Please can u help me how to disable the rename functionality for treeview root node in RAD File explorer.
By default Delete functionality will disable for root node while right clicking on context menu treeview in file explorer .same thng it should happen for reanme.other than root node it should enable rename functionality
Please can u help me out..
How to solve this?
and one more thing how to get root node text on client side.
Thanks\
Bhavani
Please can u help me how to disable the rename functionality for treeview root node in RAD File explorer.
By default Delete functionality will disable for root node while right clicking on context menu treeview in file explorer .same thng it should happen for reanme.other than root node it should enable rename functionality
Please can u help me out..
How to solve this?
and one more thing how to get root node text on client side.
Thanks\
Bhavani
5 Answers, 1 is accepted
0

Mani Pandian
Top achievements
Rank 1
answered on 27 May 2011, 05:25 PM
Hi,
For this to happen you can use the OnClientContextMenuShown client function by setting the
Note : Replace the string "/Root/" with your root folder name and the args.get_node().get_value();
will fetch you the name of the current selected node.
For this to happen you can use the OnClientContextMenuShown client function by setting the
radFileExplorer.TreeView.OnClientContextMenuShown ="OnClientContextMenuShown" on serevr side logic
Client Script :
function OnClientContextMenuShown(oTreeView, args) {
var pathToItem = args.get_node().get_value();
var treeContextMenuItems = args.get_menu().get_allItems();
if (pathToItem == "/Root/") {
for (var i = 0; i < treeContextMenuItems.length; i++) {
var menuItem = treeContextMenuItems[i];
if (menuItem.get_value() == "Rename" || menuItem.get_value() == "Copy") {
menuItem.set_enabled(false);
}
}
}
}
Note : Replace the string "/Root/" with your root folder name and the args.get_node().get_value();
will fetch you the name of the current selected node.
Hope this helps
Mani
0

juan
Top achievements
Rank 1
answered on 20 Jul 2011, 10:41 PM
but now if i want to not visible in the GridContextMenu?
i have this code but is wrong.
RadFileExplorer1.GridContextMenu.OnClientShown = "EliminarOpcionesEnMenu"
<script type="text/javascript">
function EliminarOpcionesEnMenu(oTreeView, args) {
var pathToItem = args.get_node().get_value();
var treeContextMenuItems = args.get_menu().get_allItems();
for (var i = 0; i < treeContextMenuItems.length; i++) {
var menuItem = treeContextMenuItems[i];
if (menuItem.get_value() == "Rename" || menuItem.get_value() == "Copy") {
menuItem.set_visible(false);
}
}
}
</script>
i have this code but is wrong.
RadFileExplorer1.GridContextMenu.OnClientShown = "EliminarOpcionesEnMenu"
<script type="text/javascript">
function EliminarOpcionesEnMenu(oTreeView, args) {
var pathToItem = args.get_node().get_value();
var treeContextMenuItems = args.get_menu().get_allItems();
for (var i = 0; i < treeContextMenuItems.length; i++) {
var menuItem = treeContextMenuItems[i];
if (menuItem.get_value() == "Rename" || menuItem.get_value() == "Copy") {
menuItem.set_visible(false);
}
}
}
</script>
0

Mani Pandian
Top achievements
Rank 1
answered on 20 Jul 2011, 11:03 PM
Try this out
Reference :
http://www.telerik.com/community/forums/aspnet-ajax/grid/remove-options-from-radgrid-header-context-menu.aspx
RadFileExplorer1.GridContextMenu.OnClientShown = "EliminarOpcionesEnMenu"
<
script
type
=
"text/javascript"
>
function EliminarOpcionesEnMenu(oTreeView, args) {
var pathToItem = args.get_node().get_value();
var treeContextMenuItems = args.get_menu().get_allItems();
for (var i = 0; i < treeContextMenuItems.length; i++) {
var menuItem = treeContextMenuItems[i];
if (menuItem.get_value() == "Rename" || menuItem.get_value() == "Copy") {
menuItem.style.diplay ="none";
}
}
}
< /script>
Reference :
http://www.telerik.com/community/forums/aspnet-ajax/grid/remove-options-from-radgrid-header-context-menu.aspx
0

Terri-Lynn
Top achievements
Rank 1
answered on 31 Oct 2011, 11:18 PM
Hi all:
This solution is almost exactly what I want, BUT, I want to pass to the function which folders specificially. I don't want to hard code it in like the above solution ("/Root/"). Any further ideas??
This solution is almost exactly what I want, BUT, I want to pass to the function which folders specificially. I don't want to hard code it in like the above solution ("/Root/"). Any further ideas??
0
Hi Terri-Lynn,
I am not quite sure I understand the exact scenario. The modifications discussed in this thread are regarding hiding the Rename for the root (top level) folder set to RadFileExplorer. If you need to apply this modification for multiple scenarios (or in a scenario where the root folder can be changed dynamically) you can use the following approach to dynamically access the path of the root node:
I hope this helps.
Kind regards,
Dobromir
the Telerik team
I am not quite sure I understand the exact scenario. The modifications discussed in this thread are regarding hiding the Rename for the root (top level) folder set to RadFileExplorer. If you need to apply this modification for multiple scenarios (or in a scenario where the root folder can be changed dynamically) you can use the following approach to dynamically access the path of the root node:
function
OnClientContextMenuShown(oTreeView, args)
{
var
pathToItem = args.get_node().get_value();
var
rootNodes = oTreeView.get_nodes();
var
rootPaths = [];
for
(
var
i = 0; i < rootNodes.get_count(); i++) {
rootPaths.push(rootNodes.getNode(i).get_value());
}
var
treeContextMenuItems = args.get_menu().get_allItems();
if
(rootNodes.indexOf(pathToItem) > -1) {
for
(
var
i = 0; i < treeContextMenuItems.length; i++) {
var
menuItem = treeContextMenuItems[i];
if
(menuItem.get_value() ==
"Rename"
|| menuItem.get_value() ==
"Copy"
) {
menuItem.set_enabled(
false
);
}
}
}
}
I hope this helps.
Kind regards,
Dobromir
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