Call JavaScript Function From Code Behind C#

you can add in codebehind 

Page.ClientScript.RegisterStartupScript(this.GetType(),"CallYourFunction","YourFunction()",true);

 

and also define javascript code 

same as bellow:

string str="<script>alert(\"ok\");</script>";

Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", str, false);

Subscribe to c#