calling OnClientNodeClicked function from server side

2 posts, 0 answers
  1. Sean
    Sean avatar
    3 posts
    Member since:
    Feb 2011

    Posted 17 Sep 2012 Link to this post

    Hi:
    I have a client function for OnClientNodeClicked  
       function NodeClicked (sender, args)

    i use this function to calculate how many checked nodes.
    Now, i am doing something on server side and do not want to write the same function on server side again. Is there a way i can call  NodeClicked (sender, args)  function from server side ?

    thanks for helping

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Sep 2012 Link to this post

    Hi Sean,

    I suppose you want to call a NodeClicked function in the code behind. Try the following code snippet to achieve your scenario.

    C#:
    string script = "<script language='javascript'>function f(){OnClientNodeClicked(" + treeView + "," + Node + "); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
    Page.ClientScript.RegisterStartupScript(this.GetType(), "Pass", script);

    JS:
    <script type="text/javascript">
        function OnClientNodeClicked(sender, args) {
           // Your Code
        }
    </script>

    Please elaborate your scenario if it doesn't helps.

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top