Hi
Is there a way to create and attach context menus to the items on the tree based on the level they are on after the data is bound to the tree??
Would it be any different if it were a load on demand tree.?
Because I would have or not have different context menus on different nodes depending on their level.
Thanks
7 Answers, 1 is accepted
0
Accepted
0
Thomas
Top achievements
Rank 1
answered on 18 Apr 2011, 05:33 PM
The posted solution works fine in cases where you can load the permissions or lets say the "context menu items that should be shown on a specific item" are know at the time when you create the treeviewitem. Is there any solution to load this information on demand. So, for example:
A tree with some item A, B and C.
A context menu with the items "Add" and "Delete"
When the user requests the context menu for item A we have to ask the server if the user is allowed to add/delete.
I can't do a postback, otherwise the context menu disappears again. I can't use any async webservice-call either.
Any suggestions how I could solve this?
Thanks in advance,
Thomas
A tree with some item A, B and C.
A context menu with the items "Add" and "Delete"
When the user requests the context menu for item A we have to ask the server if the user is allowed to add/delete.
I can't do a postback, otherwise the context menu disappears again. I can't use any async webservice-call either.
Any suggestions how I could solve this?
Thanks in advance,
Thomas
0
Hi Thomas,
If the context that you need to request is the user permissions, then you can create the context menu server side with regard to this factor. Could you, please, share what seems to be the problem implementing it this way?
Regards,
Nikolay Tsenkov
the Telerik team
If the context that you need to request is the user permissions, then you can create the context menu server side with regard to this factor. Could you, please, share what seems to be the problem implementing it this way?
Regards,
Nikolay Tsenkov
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Thomas
Top achievements
Rank 1
answered on 26 Apr 2011, 08:30 AM
The problem is that:
1. The user permissions are item-specific. A user might have the right to rename and delete "tree item A", but does not have the permission to delete "tree item B"
2. The tree is large and loading the permission for one tree item does take very long. So loading the permissions for all items when the tree is created is infeasible.
Therefore we want to load the permissions for a tree item from the server when the user right-clicks a tree item and before the menu is shown.
OnClientContextMenuShowing seemed perfect, but doesn't really work out, as mentioned before. A server-side event OnContextMenuShowing would solve the problem, but doesn't exist.
Any workarounds?
Regards,
Thomas
1. The user permissions are item-specific. A user might have the right to rename and delete "tree item A", but does not have the permission to delete "tree item B"
2. The tree is large and loading the permission for one tree item does take very long. So loading the permissions for all items when the tree is created is infeasible.
Therefore we want to load the permissions for a tree item from the server when the user right-clicks a tree item and before the menu is shown.
OnClientContextMenuShowing seemed perfect, but doesn't really work out, as mentioned before. A server-side event OnContextMenuShowing would solve the problem, but doesn't exist.
Any workarounds?
Regards,
Thomas
0
Hello Thomas,
Please find attached a sample how to achieve this with RadAjaxManager.
Hope it helps.
Greetings,
Helen
the Telerik team
Please find attached a sample how to achieve this with RadAjaxManager.
Hope it helps.
Greetings,
Helen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Thomas
Top achievements
Rank 1
answered on 02 May 2011, 12:27 PM
Hello,
Thank you very much for your effort. But unfortunately, this solution has a problem:
You show the menu with the client script:
The menu shows up, but none of the click-events of the context menu items (OnClientContextMenuItemClicking, OnClientContextMenuItemClicked, OnContextMenuItemClick,...) works anymore.
To verify this... in your example solution add the to client events to the RadTreeView-Tag:
OnClientContextMenuItemClicking="MenuItemClicking" OnClientContextMenuItemClicked="MenuItemClicked"
and some event handlers like this:
Nothing happens when you click on a menu item (no matter if it's enabled or not)
Is there any way to fix this?
Thank you very much for your effort. But unfortunately, this solution has a problem:
You show the menu with the client script:
var
menu = $find(
"<%= Menu1.ClientID %>"
);
menu.showAt(menuX, menuY);
The menu shows up, but none of the click-events of the context menu items (OnClientContextMenuItemClicking, OnClientContextMenuItemClicked, OnContextMenuItemClick,...) works anymore.
To verify this... in your example solution add the to client events to the RadTreeView-Tag:
OnClientContextMenuItemClicking="MenuItemClicking" OnClientContextMenuItemClicked="MenuItemClicked"
and some event handlers like this:
function
MenuItemClicking(sender, args) {
alert(
"menu item clicking"
);
}
function
MenuItemClicked(sender, args) {
alert(
"menu item clicked"
);
}
Nothing happens when you click on a menu item (no matter if it's enabled or not)
Is there any way to fix this?
0
Hi Thomas,
Please modify the "OnAjaxResponseEnd" javascript function like the following:
Hope it helps.
Kind regards,
Helen
the Telerik team
Please modify the "OnAjaxResponseEnd" javascript function like the following:
function
OnAjaxResponseEnd(sender, args)
{
if
(args.EventArgument == nodeText) {
var
menu = $find(
"<%= Menu1.ClientID %>"
);
var
tree = $find(
"<%= RadTreeView1.ClientID %>"
);
menu.showAt(menuX, menuY);
menu.add_itemClicking(MenuItemClicking);
menu.add_itemClicking(MenuItemClicked);
}
}
Hope it helps.
Kind regards,
Helen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.