client side treeview context menu!

4 posts, 1 answers
  1. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 24 Apr 2009 Link to this post

    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
  2. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 24 Apr 2009 Link to this post

    actually   $find('myTelerikToolbar1').findItemByValue('something').hide();    does not work!

    it doesn't hide the telerik rad toolbar menu item.
  3. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 24 Apr 2009 Link to this post

    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.
  4. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 27 Apr 2009 Link to this post

    thanks, shinu.
Back to Top