Click here to Skip to main content
15,883,606 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
hello
i have a java script function
XML
<script>function go(loc) {
           document.getElementById('ifm').src = loc;
       }
   </script>



i want to call this im my c# page in a button click event how can i do this

Thanks & Regards
Srishti
Posted

Hi,

you can make use of RigisterCLientScriptBlock function. check below msdn article.
ClientScriptManager.RegisterClientScriptBlock Method (Type, String, String)[^]
ClientScriptManager.RegisterClientScriptBlock Method (Type, String, String, Boolean)[^]

hope it helps.
 
Share this answer
 
Comments
srishti056 13-May-13 2:17am    
sorrry i dont understand
Karthik Harve 13-May-13 2:43am    
you have to use like below.

ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "MyScript", "go('www.google.co.in');", true);
Use
Page.RegisterClientScriptBlock("key", "script");


to register javascript code in ur codebehind file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900