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

    Hi,

     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?

     

    Thanks!

     

     

     

  2. Eyup
    Admin
    Eyup avatar
    3007 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.

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