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

single click

5 Answers 75 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
richard
Top achievements
Rank 1
richard asked on 18 Dec 2011, 12:49 AM
Please can you tell me if it is possible to expand a treenode node with single click using populate on demand server side.

Thank you very much

Richard

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Dec 2011, 05:15 AM
Hello,

Try the following code snippet to expand on node click.
CS:
protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
 {
  RadTreeView1.SelectedNode.Expanded = true;
 }

Thanks,
Princy.
0
Plamen
Telerik team
answered on 19 Dec 2011, 01:08 PM
Hi Richard,

I would recommend you rather add the method that populates the nodes to the click event. Here is the code that I added to our Load on demand Modes demo that worked at my side:
protected void RadTreeView2_NodeClick(object sender, RadTreeNodeEventArgs e)
   {
       if (e.Node.Nodes.Count == 0)
           PopulateNodeOnDemand(e, TreeNodeExpandMode.ServerSide);
   }

Hope this will be helpful.

All the best,
Plamen Zdravkov
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
0
richard
Top achievements
Rank 1
answered on 19 Dec 2011, 01:33 PM
Many thanks Plamen

I have tried your code snippet, but it does not seem to respond to a single click?
I am wondering do I need to assign it to an event in the ASPX file?

I have looked at  your modes demo but this also only seams to respond to a double click.

Best Regards
Richard
0
richard
Top achievements
Rank 1
answered on 19 Dec 2011, 02:11 PM
Update:
I have tried allocating your snippet to OnNodeClick but this seems to trigger a complete postback and the whole page is refereshed, and the OnNode|Expand event is not fired at all.

I think somehow I need a client side click event that will somehow trigger the event assigned to OnNodeExpand
0
Plamen
Telerik team
answered on 19 Dec 2011, 06:18 PM
Hi Richard,

You can try to use the onClientNodeClick event as in the code:
function clientNodeClicked(sender, args){
args.get_node().set_expanded(true);

Hope this will help.

Kind regards,
Plamen Zdravkov
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
richard
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Plamen
Telerik team
richard
Top achievements
Rank 1
Share this question
or