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

calling OnClientNodeClicked function from server side

1 Answer 54 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 17 Sep 2012, 09:56 PM
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

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Sep 2012, 06:32 AM
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.
Tags
TreeView
Asked by
Sean
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or