K Viltersten wrote:
Quote:
Quote:
Quote:
>>In the client.js file i declare the following variable.
>>>
>> ...
>> var str = "info";
>> ...
>>>
>>In the corresponding ASP file called server.aspx.cs i declare two
>>following methods.
>>>
>> protected void Page_Load (
>> object sender, EventArgs e){...}
>> public void SomeThing () {
>> ...
>> String data;
>> ...}
>> ...
>>>
>>The objective is to _SOMEHOW_ ensure that the value of data (in the
>>CS file) is obtained from str (in the JS file).
>>
>It cannot be done without another HTTP request (can be XHR) because the
>two don't know about each other. If you don't know that by now, you
>should get some basic knowledge about client-server architectures
>first, before messing around with them.
>
Thanks! Trying not to be impolite i still need to point that the question
was "how can it be done", not the opposite.
"It cannot be done without ... (can be ...) ..." reads pretty much the same
to me.
Quote:
Are you suggesting that the only (recommended) way to to request
(another) page from the server?
Yes, the only way is to make a request to the server.
You can also make a POST request, of course.
Quote:
Perhaps i could bake it in the sender object. What do you think?
I don't know about a `sender' object. Must be ASP .NET-specific.
As I said, if you don't want to submit a form, you can do an XHR, something
along this:
var req = new XMLHttpRequest();
if (req)
{
req.open("POST", "file.aspx", true);
req.onreadystatechange = function() {
if (req.readyState == 4)
{
if (req.status == 200)
{
// handle success
}
else
{
// handle error
}
}
};
req.send("str=" + encodeURIComponent(str));
}
(See previous/other discussions about AJAX/XHR for details.)
Probably the `sender' object you are talking about is just a
Microsoft-provided wrapper for this.
Nothing will work without the sufficient support for client-side scripting
and XHR, but I guess as you are using ASP .NET which does not degrade
gracefully by default, you already know that.
PointedEars
P.S.
Signatures are to be delimited with "-- <CR><LF>", not "--<CR><LF>".
If you had that and your software messed with it, I suggest you fix it
or use better software. See also
http://insideoe.com/
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>