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

Pb NodeClick Event - RadTreeView

1 Answer 67 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
aurelie
Top achievements
Rank 1
aurelie asked on 04 Feb 2008, 09:36 AM

I have a problem with my radTreeView with sharepoint. I would like to put an event on the click of the treeview.

I tried to put in my aspx code :

<script runat="server">

protected void RadTreeView1_NodeClick(object o, RadTreeNodeEventArgs e)

{

Label1.Text = TreeView1.SelectedNode.Value.ToString();

}

</script>

(I put AutoEventWireup="true" )

but when i click on an item of my treeview, my application doesn't execute this function.

I tried also to put the function

protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)

{

Label1.Text = TreeView1.SelectedNode.Value.ToString();

}

in my aspx.cs code and I also put :

protected override void OnInit(EventArgs e)

{

InitializeComponent();

base.OnInit(e);

}

private void InitializeComponent()

{

this.RadTreeView1.NodeClick += new Telerik.WebControls.RadTreeView.RadTreeViewEventHandler(this.RadTreeView1_NodeClick);

}

But when I execute my application this function doesn't work, it's not executed.

In the both cases, when I click, my application is redirected to the URL of the node. I would like the function TreeView1_SelectedNodeChanged is executed before the redirection.

Thank you for your help

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 04 Feb 2008, 05:47 PM
Hello aurelie,

First of all, please make sure that the AutoPostBack property of the treeview is enabled.

Also, you cannot execute a NodeClick and page redirection(using the NavigateUrl property of the node) at the same time. You can use the following approach to accomplish the task:
  1. Store the url in the Value property of the node
  2. Hook on the BeforeClientClick event and use window.open to open a new page. Get the url from the node's Value. For more details please refer to the RadTreeNode Client-Side object model
  3. Make sure to return true in the BeforeClientClick event handler
  4. The NodeClick event will be fired right after
Hope this helps.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Sharepoint Integration
Asked by
aurelie
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or