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

RadTreeView OnNodeClick vs Double Click

3 Answers 385 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 11 Aug 2011, 04:04 PM
I have a ASP.Net app with a user control that contains the RadTreeView control. Currently the RadTreeView control does not have any double click event define. However, double clicking a node in the tree does collapse or expand it's child nodes. I assume this is the default behavior for the RadTreeView. This is the desired behavior we want.

I want to add an OnNodeClick event to this tree so a user can select a node and fire an event.

However, some pages that consume this user control don't want the OnNodeClick event. Instead they want to be able to just select/highlight a node. These are the same pages that want the Double click to expand and collapse the nodes.

When I add the OnNodeClick event to the RadTreeView user control, the pages that want the OnNodeClick event work as desired.

But the original pages that don't want the OnNodeClick event work OK except that the Double Click no longer collapses or expands the nodes. When double clicked, the node collapses then expands immediately.

How can I turn the OnNodeClick event off on some pages and on for other pages?

Or, can I programmatically  define the OnNodeClick event dynamically on the pages that needs it?


3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 17 Aug 2011, 10:49 AM
Hi Jerry,

You can try to add the handler in the Page_Load event like in the code bellow:

protected void Page_Load(object sender, EventArgs e)
   {
       if (true)
       {
           RadTreeView1.NodeClick += new RadTreeViewEventHandler(RadTreeView1_NodeClick);
       }
       
   }
 
   void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
   {
       throw new NotImplementedException();
   }

Hope this helps.

All the best,
Plamen Zdravkov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Neelim
Top achievements
Rank 1
answered on 19 Feb 2013, 09:46 PM
HI 

I have tried all these techniques. But for my scenario, when I double click - need to open 'Edit page' relevant to each node . Basically the node items has 'Menu Page' menu  ( included- Edit,Delete,Clone)  which will appear when I right click on the node! 

In more detail - On my server side I can able to call this Menu page using a event handler. But how can I call that event handler from client side. Because we only have client side double click event for radtreeview control ! 

Hope it is clear !
Anyone can help me please?
Appreciate,
Neelim.
0
Plamen
Telerik team
answered on 22 Feb 2013, 02:50 PM
Hi Neelim,

 
In RadTreeView you have also onClientClicking event and you can use it to perform and AjaxRequest for example.

Hope this will be helpful.

Greetings,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TreeView
Asked by
Jerry
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Neelim
Top achievements
Rank 1
Share this question
or