execute NavigateURL property programatically

2 posts, 0 answers
  1. Minas
    Minas avatar
    5 posts
    Member since:
    Sep 2012

    Posted 17 Nov 2012 Link to this post

    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?.

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 21 Nov 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top