Javascript call in Sub Procedure

  • Thread starter Thread starter mianiro
  • Start date Start date
M

mianiro

Hi everyone

I need a little bit of help ... I need to call a javascript function
inside of a .net sub procedure. Here is my code:

ClientScript.RegisterClientScriptBlock(Me.GetType(), "", "<script
language='JavaScript'> function OpenChild() " & _
"{" & _
"var ParmA = retvalA.value;" & _
"var ParmB = retvalB.value;" & _
"var ParmC = retvalC.value;" & _
"var MyArgs = new Array(ParmA, ParmB, ParmC);" & _
"var WinSettings =
""center:yes;resizable:no;dialogHeight:300px""" & _
"var MyArgs = window.showModalDialog(" & _
"""CompanyInfo.aspx"", MyArgs, WinSettings);" & _
"if (MyArgs == null)" & _
"{" & _
"}" & _
"else" & _
"{" & _
"retvalA.value=MyArgs[0].toString();" & _
"retvalB.value=MyArgs[1].toString();" & _
"}" & _
"} </script>")

Am I going about this the right way? Nothing seems to happen when I hit
this code in the debugger. Is there another way to call javascript from
a sub procedure?
 
What your code does is send this JavaScript down to the client machine so
that it will be executed on the client-side. Since it is client-side code,
you can't step through it with the server-side debugger.
 
This script just defines the function, I think what you need to do is call
the function.. Declare the function in an include file or inline in the page
and then use something like this to call it...

ClientScript.RegisterClientScriptBlock(Me.GetType(), "", "<script
language='JavaScript'>OpenChild(); </script>")
 
Yes .. tried that, but no results. I wish i could step through the
javascript. I dont know if it is my js code or the way i'm calling it.
I think I'm going to try a workaround ...

Thanks for the helpthough

This script just defines the function, I think what you need to do is call
the function.. Declare the function in an include file or inline in the page
and then use something like this to call it...

ClientScript.RegisterClientScriptBlock(Me.GetType(), "", "<script
language='JavaScript'>OpenChild(); </script>")



mianiro said:
Hi everyone
I need a little bit of help ... I need to call a javascript function
inside of a .net sub procedure. Here is my code:
ClientScript.RegisterClientScriptBlock(Me.GetType(), "", "<script
language='JavaScript'> function OpenChild() " & _
"{" & _
"var ParmA = retvalA.value;" & _
"var ParmB = retvalB.value;" & _
"var ParmC = retvalC.value;" & _
"var MyArgs = new Array(ParmA, ParmB, ParmC);" & _
"var WinSettings =
""center:yes;resizable:no;dialogHeight:300px""" & _
"var MyArgs = window.showModalDialog(" & _
"""CompanyInfo.aspx"", MyArgs, WinSettings);" & _
"if (MyArgs == null)" & _
"{" & _
"}" & _
"else" & _
"{" & _
"retvalA.value=MyArgs[0].toString();" & _
"retvalB.value=MyArgs[1].toString();" & _
"}" & _
"} </script>")
Am I going about this the right way? Nothing seems to happen when I hit
this code in the debugger. Is there another way to call javascript from
a sub procedure?- Hide quoted text -- Show quoted text -
 
Back
Top