How to use ContextMenu for PanelBar

3 posts, 0 answers
  1. VnDevil
    VnDevil avatar
    58 posts
    Member since:
    Oct 2012

    Posted 17 Feb 2010 Link to this post

    Hi, how can I use RadContextMenu for RadPanelBar, please give me an example :)
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Feb 2010 Link to this post

    Hello,

    You can try the following approach in order to use RadContextMenu for RadPanelBar.

    Attach 'OnClientContextMenu' to RadPanelBar and save the clicked item text in a global variable or HiddenField, then you can manipulate/use in the menu's ItemClicked event.

    aspx:
     
     
    <telerik:RadPanelBar ID="RadPanelBar1" runat="server" OnClientContextMenu="OnClientContextMenu"
        <Items> 
          . . .  
        </Items> 
    </telerik:RadPanelBar> 
     
    <telerik:RadContextMenu ID="RadContextMenu1" runat="server" OnItemClick="RadContextMenu1_ItemClick" 
        OnClientItemClicked="OnClientItemClicked"
        <Items> 
          . . . 
        </Items> 
        <Targets> 
            <telerik:ContextMenuControlTarget ControlID="RadPanelBar1" /> 
        </Targets> 
    </telerik:RadContextMenu> 
     
    <asp:HiddenField ID="HiddenField1" runat="server" /> 

    javascript:
     
    <script type="text/javascript"
        function OnClientContextMenu(sender, args) {        
            var hf = document.getElementById('HiddenField1'); 
            hf.value = args.get_item().get_text(); 
        } 
        function OnClientItemClicked(sender, args) { 
            var hf = document.getElementById('HiddenField1'); 
            alert("Right Clicked on " + hf.value); 
            alert("Clicked on menu item :" + args.get_item().get_text()); 
        }     
    </script> 

    Regards,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. VnDevil
    VnDevil avatar
    58 posts
    Member since:
    Oct 2012

    Posted 18 Feb 2010 Link to this post

    Thanks for help :D, I did it
Back to Top