Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all

please help on this

i am unable to call it from code behind

JavaScript
<script type="text/javascript">
function showError(msg) 
{

       document.getElementById('frm2')[0].src = msg;



 }
 
 
  </script>

please help
Posted
Updated 2-Oct-13 19:26pm
v2
Comments
Vivek_Maruxxxx 3-Oct-13 1:28am    
you should provide enough information about the code....
[no name] 3-Oct-13 1:35am    
Ctrl + V all code related to above bits of code

hi,
Try this to call your javascript from code behind:
C#
protected void Page_Load(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterStartupScript(this.GetType(), "Call_my_function", "showError('hello this is a message from server side!')", true);
    }
 
Share this answer
 
C#
Page.ClientScript.RegisterStartupScript(this.GetType(),"alert","showError('I am a boy');",true);


Use the above in your code-behind and it should work..
-Anurag
 
Share this answer
 
v2

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