473,465 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dynamically generated controls (Javascript) not posting values to server

I've a very strange issue here. I've this JS code:

var hidden = document.createElement('input')
//hidden.type='hidden';
hidden.value = getIdForUser(userTag)
$('assignedUsersInputs').appendChild(hidden);
var i =0;
for(var node = $('assignedUsersInputs').firstChild;node !=null; node =
node.nextSibling)
{
if(node.nodeType != 1) //input
continue;
node.id = 'project.Users['+i+'].Id';
i++;
}

I use it to create a couple of inputs, and then I post to the server,
but the server side can't see those controls.
When I do request.Params.AllKeys, I can't see those values there, but
they exists (enabled, btw) on the client.
This behavior is consistent in both IE and FF, so I think this is
something that I'm doing wrong.
Any ideas?

Feb 27 '06 #1
2 1341
Unless you create the hidden control as an ASP.NET control, I don't think
ASP.NET is going to "see" your control.

The server-side code used by ASP.NET needs to be told about anything
generated on the client-side, especially if it is dynamic.

Try creating two ASP.NET server-side hidden controls and storing whatever
values you get from the dynamic inputs in those?

Let us know?

Ken
Microsoft MVP [ASP.NET]
<ay****@gmail.com> wrote in message
news:11**********************@z34g2000cwc.googlegr oups.com...
I've a very strange issue here. I've this JS code:

var hidden = document.createElement('input')
//hidden.type='hidden';
hidden.value = getIdForUser(userTag)
$('assignedUsersInputs').appendChild(hidden);
var i =0;
for(var node = $('assignedUsersInputs').firstChild;node !=null; node =
node.nextSibling)
{
if(node.nodeType != 1) //input
continue;
node.id = 'project.Users['+i+'].Id';
i++;
}

I use it to create a couple of inputs, and then I post to the server,
but the server side can't see those controls.
When I do request.Params.AllKeys, I can't see those values there, but
they exists (enabled, btw) on the client.
This behavior is consistent in both IE and FF, so I think this is
something that I'm doing wrong.
Any ideas?

Feb 27 '06 #2
I'm not trying to make ASP.Net see them, I'm trying to extract those
values manually.
The problem is, as far as I can see, they are not sent to the server
from the browser

Feb 27 '06 #3

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

Similar topics

12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
5
by: Dennis Fazekas | last post by:
Greetings, I am creating a web form which will all the user to add an unlimited number of email addresses. Basically I have 3 buttons, "Add Another Email", "-" to remove, and a "Save" button....
3
by: Dotnet Gruven | last post by:
I've built a WebForm with a Table added dynamically in Page_Load when IsPostBack is false. The table includes a couple of TextBoxes, RadioButtonLists and CheckboxLists. On postback, those...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
4
by: Lewis Holmes | last post by:
Hi I have the following situation in one of my asp.net pages. The user can add multiple table rows to a form by selecting a button. These rows can contain asp.net controls. When this button is...
3
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.