Running a script from C#

  • Thread starter Thread starter MW de Jager
  • Start date Start date
M

MW de Jager

I am running a script from C#, but I need a returnvalue to be passed back to
my code.

I am currently using RegisterStartupScript, but this does not allow me to
receive anything back from the java script. Any ideas on how to do this?

Kind regards
MW de Jager
 
MW said:
I am running a script from C#, but I need a returnvalue to be passed
back to my code.

I am currently using RegisterStartupScript, but this does not allow
me to receive anything back from the java script. Any ideas on how
to do this?
Kind regards
MW de Jager

When you do a RegisterStartupScript (or RegisterClientScript), the script
is added to the output that will be sent to the browser. Nothing is executed (yet).
Only when the server-side is done, the html (containing your script) is
sent to the browser, which then may execute that script.

To get a return value, you could write the result to a hidden input (that you
can read when the page is submitted again),
or redirect to some special url, with that result in the querystring.

Hans Kesting
 
Hans, here is what I'm trying to do.

I use RegisterStartupScript to run a javascript to do a showModalWindow.

This works fine, but I cannot get to the result that is passed back,



Hans,

I'm trying to make a dialog box (webpage) that will allow me to send back a
result like OK or Cancel etc.

I call some javascript that does a showModalDialog which works just fine.

Only problem is, I can't see the result in my C# code.

Any ideas, or is there another way to do this?

Kind regards
MW
 
Back
Top