RadContextMenu - OnClientItemClicked arg.get_targetElement does not work as expected

2 posts, 0 answers
  1. Seth
    Seth avatar
    90 posts
    Member since:
    Jun 2007

    Posted 09 Jul 2009 Link to this post

    I am trying to use a standard RadContextMenu control with either a RadTreeView or the new RadListBox.  I have implemented the OnClientItemClicked event as follows:

    function menuItemmClicked(sender, args) {
        var itemTarget = args.get_targetElement();

    Is this function supposed to return an object?  Do I need to cast it?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jul 2009 Link to this post

    Hi Seth,

    If you want to get the client side object of clicked node, then you can try out the following approach (in the case of you are using separate contextmenu for RadTreeView).

    <telerik:RadContextMenu ID="RadContextMenu1" runat="server" OnClientItemClicked="OnClientItemClicked"
         . . . 
            <telerik:ContextMenuControlTarget ControlID="RadTreeView1"></telerik:ContextMenuControlTarget> 
    <telerik:RadTreeView ID="RadTreeView1" runat="server"
         . . . 

    <script type="text/javascript"
    function OnClientItemClicked(sender, args) 
        var itemTarget = args.get_targetElement(); 
        var clickedNodeText = itemTarget.innerHTML// Clicked node's text 
        var tree = $find("<%= RadTreeView1.ClientID %>"); // Clientside object of RadTreeView 
        var node = tree._findItemByText(itemTarget.innerHTML); // Access the client side object of clicked node  

Back to Top