Click here to Skip to main content
14,641,690 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi all

please help on this

i am unable to call it from code behind

<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....
PBGuy 3-Oct-13 1:35am
   
Ctrl + V all code related to above bits of code
Rate this:
Please Sign up or sign in to vote.

Solution 1

hi,
Try this to call your javascript from code behind:
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);
    }
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Page.ClientScript.RegisterStartupScript(this.GetType(),"alert","showError('I am a boy');",true);


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

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100