Thread: variables
View Single Post
  #2 (permalink)  
Old September 9th, 2008, 07:06 PM
Old Pedant Old Pedant is offline
Friend of Wrox
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

There are only two ways to pass data to *ANY* server side application: Via a query string or via POST data. And in both cases, you must do so by "hitting" a URL on the server.

In general, with ASP.NET, you would use POST data. And that means you must send the data by submitting a <FORM>.

So the first answer is simple: Use a form field (i.e., <INPUT NAME=whatever>).

And the expansion on that answer is also simple: Use hidden form field(s) and then use JavaScript coding to copy the value of the JS variable(s) into the form field value(s).

I assume this is related to your question about panning an image, so you could just do:
    document.forms[0].panX.value = panX;
    document.forms[0].panY.value = panY;
assuming you have hidden form fields named panX and panY and javascript variables of the same name. (No reason for them to be same; just makes sense for them to be, for housekeeping.)

Now when the user submits the <FORM> (presumably, by clicking on your ZOOM button), those values will be available to your C# code via simply
Reply With Quote