473,414 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Moving a string from client to server (JS -> ASPX)

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).

Note that i don't need data to be
dynamically updated as soon as str is
changed. It's sufficient to call the
method SomeThing each time we pass the
part of code where we assign the value
"info" to str.

Note also that i need to notify
SomeThing about the value of str.

Of course, the actual situation is far
more complicated but my problem can be
boiled down to this simple case.

How should SomeThing be designed? How
need i to reconstruct the lines after
the assignment to str?

--
Regards
Konrad Viltersten
--------------------------------
sleep - a substitute for coffee for the poor
ambition - lack of sense to be lazy

Jun 27 '08 #1
1 870
"K Viltersten" <tm**@viltersten.comwrote in message
news:69*************@mid.individual.net...
How should SomeThing be designed?
The simplest way to pass information from client to server is via a postback
(leaving callbacks / AJAX aside)...

When a page is posted back, the contents of the Request.Form collection
becomes available server-side.

Therefore, do the following:

1) Add a hidden field to the form

2) Just before the page is posted back (i.e. maybe in the OnClientClick
event of a button etc), populate the hidden field with the value from the
JavaScript variable
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: CT | last post by:
Hi, This might seem like a basic question but I have some doubts, please humour me. I have a client-server application using java where each client on each machine needs to directly...
4
by: tsui | last post by:
Dear all Someone say that past is Client/Server application, and now is distributed application, but i don't understand these terms Is it Client/Server application is mean two tiers, and only one...
1
by: Mike Dole | last post by:
I'm sorry to bother you with this question but it was either this or giving up and trying to go for a simpler solution (which I will if this is not gonna work out..) I'm afraid this is way out...
5
by: TonyM | last post by:
I recently completed the general guidelines for a future project that I would like to start developing...but I've sort of hit a wall with respect to how to design it. In short, I want to run...
3
by: Joh | last post by:
I'd like to test a server application and a client application from the same computer. Currently if I let the client try to connect to my IPv4 adress provided by my router in this case 192.168.1.2...
2
by: nsaffary | last post by:
hi I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set...
11
by: K Viltersten | last post by:
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.
10
by: Elaine121 | last post by:
Hi i've been batteling for hours and can't seem to find the problem. When my server runs and I press the connect button the gui freezes until the client gui is terminated.. only then the gui becomes...
0
by: bushramemon | last post by:
hello,,now i m working on multi-threaded client server socket program in which there is one server and multiple clients.........these both are just giving acknowledge to each other that server...
0
by: rotaryfreak | last post by:
Hello, Im building a client-server application and the user needs to input the hostName and the portNumber the client application and needs to send the portnumber to the server application. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.