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

RadTreeNode OnClientDoubleClick client event

3 Answers 108 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Peter Nanayakkara
Top achievements
Rank 1
Peter Nanayakkara asked on 05 Nov 2008, 09:58 PM
Hi all,

I have set the OnClientDoubleClick client side event for the RadTree.
This client side event will trigger when I double click on the RadTreeNode's text, but not on the RadTreeNode's image icon.

Is there a way I can also trigger the event when I double click on the icon?

I tried inspecting the RadTreeNode.Controls property thinking I will able to get a reference to the Image control and can inject my own client side event, but that Controls collection is empty.

Thanks

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Nov 2008, 05:46 AM
Hi Peter,

Here is a KB article which explains how you can attach events to Treenode images on the client side.
Attaching events to the TreeNodes' images

Shinu.

0
Peter Nanayakkara
Top achievements
Rank 1
answered on 09 Dec 2008, 04:17 AM
Thanks Shinu


Is there no way to do add the event server side?
0
Veselin Vasilev
Telerik team
answered on 09 Dec 2008, 09:55 AM
Hello Peter Nanayakkara,

No, there is no such possibility. On the code behind you can set only the name of the javascript handler which will fire when the user double clicks the node:

RadTreeView1.OnClientDoubleClick = "onDoubleClickHandler"

Here is a different workaround that you can use to in order to fire the double click event when the user double clicks the image of the node:

Put this code right after the treeview's declaration:

<script type="text/javascript"
var init = Telerik.Web.UI.RadTreeView.prototype.initialize; 
Telerik.Web.UI.RadTreeView.prototype.initialize = function () 
    init.apply(this, arguments); 
    this._eventMap.addHandlerForClassName("dblclick""rtImg"this._doubleClick);   
</script>      

This is not a recommended solution though. It overrides the initialize method and uses private members (like _eventMap) which could be changed in the future.

Use it on your own risk and after you have tested it.

Kind regards,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Peter Nanayakkara
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Peter Nanayakkara
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or