How execute javascript when selected = true

2 posts, 0 answers
  1. Isabelle
    Isabelle avatar
    11 posts
    Member since:
    May 2014

    Posted 10 Feb Link to this post


     I have a javascript function who is executed when the client click :

     treeView.OnClientNodeClicking = "MyJavascriptFunction"

    It works great.

    So, i have another code-behind function who select a node like that :

    Dim node4 As RadTreeNode = treeView.FindNodeByValue(txtHiddenModele.Value)

    If node4 IsNot Nothing Then
      node4.Selected = True          
    End If


    It works too, the node is selected but the javascript function is not executed (MyJavascriptFunction)


    How can i solve this?






  2. Eyup
    Eyup avatar
    2942 posts

    Posted 15 Feb Link to this post

    Hi Isabelle,

    This behavior is expected since you are executing this logic on the server-side. Basically, you have two options to call your script function in this case:

    1. Transfer the code-behind logic to client-side and find and select the item using javascript.
    2. After selecting the item on code-behind, use the RegisterStartupScript method to execute your javascript function.

    I hope this will prove helpful.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top