Getting data from javascript

G

Guest

Is it possible to grab data from a javascript prompt window that is called from within a webform page with C# as the behind code? I know how to activate the prompt window by calling a routine from an html button in my webform. But I want to be able to send the reply back to the server. In other words, is it possible to create a popup or prompt window that can send data to the server
 
K

Kevin Spencer

You can use JavaScript to populate a hidden form field in the page with data
that will then be available on the server with the next PostBack.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Dave said:
Is it possible to grab data from a javascript prompt window that is called
from within a webform page with C# as the behind code? I know how to
activate the prompt window by calling a routine from an html button in my
webform. But I want to be able to send the reply back to the server. In
other words, is it possible to create a popup or prompt window that can send
data to the server?
 
J

Jon

Hi,
you might be able to do something like this

if(window.confirm('are you sure you want to do this?')){
document.images['img'].src='Page.aspx?answer=yes';}
else{
document.images['img'].src='Page.aspx?answer=no';}

<img src="shim.gif" width=1 height=1 name="img">

Basically you're sending back either yes or no in the querystring to
Page.aspx without needing a server roundtrip.

Jon

Dave said:
Is it possible to grab data from a javascript prompt window that is called
from within a webform page with C# as the behind code? I know how to
activate the prompt window by calling a routine from an html button in my
webform. But I want to be able to send the reply back to the server. In
other words, is it possible to create a popup or prompt window that can send
data to the server?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top