This is a migrated thread and some comments may be shown as answers.

client side treeview context menu!

3 Answers 110 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
towpse
Top achievements
Rank 2
towpse asked on 24 Apr 2009, 08:19 PM
Is there a way I can get at a treeview context menu client side outside of any treeview specific events?
on page load i want to grab the treeview context menu and hide some items if necessary.

or do i use a radcontext menu separate from the tree and show that

i'm trying this

        Sys.Application.add_load(function() {
            //determine if user has permission.
            if (!allow('Something')) {
                $find('myTelerikToolbar1').findItemByValue('something').hide();      //THIS WORKS!!
                $find('tvContext').findItemByValue('something').hide();                    //THIS DOESN'T
            }
        });


regards

3 Answers, 1 is accepted

Sort by
0
towpse
Top achievements
Rank 2
answered on 24 Apr 2009, 08:34 PM
actually   $find('myTelerikToolbar1').findItemByValue('something').hide();    does not work!

it doesn't hide the telerik rad toolbar menu item.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 25 Apr 2009, 04:51 AM
Hello,

I tried following client side code and its working fine in my end. Give a try with following code and see whether it helps.

[aspx]
 
<telerik:radtreeview id="RadTreeView1" runat="server"
<ContextMenus> 
<telerik:RadTreeViewContextMenu ID="tvContext"
    <Items> 
        <telerik:RadMenuItem Text="Copy" Value="Copy"></telerik:RadMenuItem> 
        <telerik:RadMenuItem Text="Edit" Value="Edit"></telerik:RadMenuItem> 
    </Items> 
</telerik:RadTreeViewContextMenu> 
</ContextMenus> 
<Nodes> 
  . . . 
</Nodes> 
</telerik:radtreeview> 

[javascript]
 
<script type="text/javascript"
Sys.Application.add_load(function()  
    //determine if user has permission. 
    if (!allow('something')) 
    { 
          $find("<%= tvContext.ClientID %>").findItemByValue('Edit').hide(); 
    } 
}); 
</script> 

Checkout the documentation on RadContextMenu.
RadContextMenu

Thanks,
Shinu.
0
towpse
Top achievements
Rank 2
answered on 27 Apr 2009, 12:44 PM
thanks, shinu.
Tags
TreeView
Asked by
towpse
Top achievements
Rank 2
Answers by
towpse
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or