473,670 Members | 2,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Client-Side Hidden Field Update Problem

In an aspx file I have declared a hidden field like this:
<input id="hTestVal" type=hidden value="-1" runat="server">

Defined in the code-behind like this:
protected System.Web.UI.H tmlControls.Htm lInputHidden hTestVal;

In client-side JavaScript I set the value like this:
document.all("h TestVal").Value = "yo";

The problem is that the value of the hidden field (hTestVal) does not get
updated (It is not updated on Postback, and when I view the source of the
rendered aspx page in IE6, the value is still "-1" even though the
client-side script has executed (to set the value to "yo").

I believe the value is in fact getting updated in the client, because the
following line, when executed immediately after setting the value to "yo"
produces the/that new value:
alert(document. all("hTestVal") .Value);

FWIW, the hidden control is declared within a form, like this:
<form id="Form1" method="post" runat="server">

I'm confused because I have a virtually identical setup in other pages in my
site and those hidden fields and client-side value changes work just fine...
meaning that the value set in the client-side script shows up in the control
on the server during postback as expected.

What could be the deal? I need to receive the updated value (e.g., "yo") in
the server on postback.

Thanks
Nov 18 '05 #1
2 5141
input controls do not have a "Value" property, so your client code creates
one and sets the its value, the alert displays the value of this new
property. try updating the "value" property, which is what the control posts
back.

also you are using obsolete dom methods, which future ms browsers may not
support.

try:

document.getEle mentById("hTest Val").value = "yo";

which works with all w3c compliant browsers.

-- bruce (sqlwork.com)
"Guadala Harry" <GM**@NoSpam.co m> wrote in message
news:eI******** *****@tk2msftng p13.phx.gbl...
In an aspx file I have declared a hidden field like this:
<input id="hTestVal" type=hidden value="-1" runat="server">

Defined in the code-behind like this:
protected System.Web.UI.H tmlControls.Htm lInputHidden hTestVal;

In client-side JavaScript I set the value like this:
document.all("h TestVal").Value = "yo";

The problem is that the value of the hidden field (hTestVal) does not get
updated (It is not updated on Postback, and when I view the source of the
rendered aspx page in IE6, the value is still "-1" even though the
client-side script has executed (to set the value to "yo").

I believe the value is in fact getting updated in the client, because the
following line, when executed immediately after setting the value to "yo"
produces the/that new value:
alert(document. all("hTestVal") .Value);

FWIW, the hidden control is declared within a form, like this:
<form id="Form1" method="post" runat="server">

I'm confused because I have a virtually identical setup in other pages in my site and those hidden fields and client-side value changes work just fine... meaning that the value set in the client-side script shows up in the control on the server during postback as expected.

What could be the deal? I need to receive the updated value (e.g., "yo") in the server on postback.

Thanks

Nov 18 '05 #2
In continuing to research this, one difference between the pages that work
and the "problem page" (as described in the original post) is that the
"problem page" is rendered within a frame(set). Could this be relevant? NOTE
that all the code in question (client-side and code-behind) is all for the
same aspx page - and not between pages in the frameset. In other words, I'm
*not* trying to read the hidden field from another page's code-behind.

Still looking for a direction to go with this... Thanks!

"Guadala Harry" <GM**@NoSpam.co m> wrote in message
news:eI******** *****@tk2msftng p13.phx.gbl...
In an aspx file I have declared a hidden field like this:
<input id="hTestVal" type=hidden value="-1" runat="server">

Defined in the code-behind like this:
protected System.Web.UI.H tmlControls.Htm lInputHidden hTestVal;

In client-side JavaScript I set the value like this:
document.all("h TestVal").Value = "yo";

The problem is that the value of the hidden field (hTestVal) does not get
updated (It is not updated on Postback, and when I view the source of the
rendered aspx page in IE6, the value is still "-1" even though the
client-side script has executed (to set the value to "yo").

I believe the value is in fact getting updated in the client, because the
following line, when executed immediately after setting the value to "yo"
produces the/that new value:
alert(document. all("hTestVal") .Value);

FWIW, the hidden control is declared within a form, like this:
<form id="Form1" method="post" runat="server">

I'm confused because I have a virtually identical setup in other pages in my site and those hidden fields and client-side value changes work just fine... meaning that the value set in the client-side script shows up in the control on the server during postback as expected.

What could be the deal? I need to receive the updated value (e.g., "yo") in the server on postback.

Thanks

Nov 18 '05 #3

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

Similar topics

1
2634
by: ian maclure | last post by:
I'm writing a client-server app. Client controls Server which in turn configures and controls a bunch of hardware. I want to be able to start the server from my client. Now in C/C++ one could simply run the appropriate command string through a standard "system()" call which is relatively simple. JAVA on the other hand seems to require something like RMI to do it.
2
3028
by: Raquel | last post by:
How do I know whether the 'runtime client' and the 'application development client' are installed on my machine? When I issue the command "db2licm -l", it gives the following output: Product Name = "DB2 Personal Edition" Product Password = "DB2PE" Version Information = "8.1" Expiry Date = "Permanent" Annotation = "" Other information = ""
0
4235
by: Tim Northrup | last post by:
Help! We have DB2 V7.2 (fixpak 12) installed on Windows2003 Server, and the latest V7.2 client installed on another system. The DB2CODEPAGE on all systems is set to 1208, and the database was created with code set UTF-8 / codepage 1208. (Note: Running our test application described below on the database host as opposed to a separate client system produced the same results as described below). When we perform an INSERT statement...
2
4662
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on Windows. I came across the following in the Info Center: To return a result set from a procedure to the originating application, use the WITH RETURN TO CLIENT clause. When WITH RETURN TO CLIENT is specified on a result set, no nested procedures can access the result set.
8
2736
by: Ankit Aneja | last post by:
i am doing here some some socket-client work in C# windows service it is working fine for multiple clients now i want to limit these multiple clients to 25 for example i want that when service starts objects for all these 25 clients are created and when client connects it should be accepted and will not allow more than 25 clients to connect and when client diconnects that object can be allocated to another client who requests i am not...
13
28744
by: Sandeep Singh | last post by:
I am making socket client application in C# how can i get ip address of client who has connected to server
14
4443
by: Ankit Aneja | last post by:
The code of classes given below is for server to which clients connect i want to get ip address of client which has connected pls help how can i get //listen class public class listen {
0
1731
by: khu84 | last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output. Following is the server code:- <?php function createSocketServer($host='192.168.1.34',$port=2222) { $max_clients = 10;
2
4092
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 server machine IP for client and server) please guide me? server : #include <winsock2.h> #include <iostream> #include <stdio.h> #include <string.h> #include <windows.h> #pragma comment(lib, "ws2_32");
4
9284
MMcCarthy
by: MMcCarthy | last post by:
http://bytes.com/images/howtos/projectscope_blocks.jpgAs a freelance IT consultant for over 10 years, I’ve come to appreciate well defined project scopes. A project scope is a common understanding between you and your client as to what work is included in, or excluded from, a project.In a study done by CA towards end of last year, one third of all projects end up over budget and over-spend typically 10-20% of the original budget. Primary reasons...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8815
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6216
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4213
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4393
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2802
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.