Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
im using this code to call javasCript function from code behind

C#
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'> myFunc()</script>", false);


when i use this code again , my program just call the first javasCript function !
what is the problem ?!
Posted
Updated 26-Oct-13 0:31am
v2
Comments
Anurag Sinha V 26-Oct-13 6:36am    
Are u calling this Js function from a .aspx page or a usercontrol .ascx.cs???

1 solution

try the below version:

C#
Page.ClientScript.RegisterStartupScript(this.GetType(),"alert","myFunc();",true);


JavaScript
<script type="text/javascript">
function myFunc()
{
window.alert('hii');
}
</script>
 
Share this answer
 
Comments
seyed mahmud shahrokni 26-Oct-13 6:50am    
yeeeeeeeeeeeeeeeeeeeeeeeeees , tnque :D

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