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

execute NavigateURL property programatically

1 Answer 81 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Minas
Top achievements
Rank 1
Minas asked on 18 Nov 2012, 12:13 AM

I am using Telerik RadTreeView and I am adding Nodes programatically with the following code

     subnode.NavigateUrl = "javascript:selectedNode('" + subnode.Text + "','" + "content" + "','" + myDataReader2["moduleId"] + "')";

RadTreeView1.Nodes.Add(subnode);

Thus when i am clicking the node then the javascript function selectedNode is executed. But when I am changing the selected node programmatically by using a button for ex:

 node.Focus();
 node.Selected = true; 

The javascript is not executed. Is there any way to execute its navigateurl property programmatically?.

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 21 Nov 2012, 04:48 PM
Hello Minas,

Setting a JavaScript function for NavigateURL property will consider executing that function when user clicks on that node. Programmatically you are able to call an existing JavaScript function using this type of expression:

Page.ClientScript.RegisterStartupScript(this.GetType(),
            "selectednodeFn", "selectednode(" + subnode1.Text + ");", true);

since in your case the NavigateURL is your JavaScript function.


Regards,
Boyan Dimitrov
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
Minas
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or