473,398 Members | 2,393 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,398 software developers and data experts.

how to grab values from javascript generated items?

HI,

Im on dotnet 1.1

I've generated extra checkboxes, textboxes via client side javascript:

eg:
var inputElement = document.createElement('input');

inputElement.setAttribute('type', 'radio');...

inputElement.setAttribute('id', 'xx');

....

How do i capture these values via server side?

Pls advise.

Thanks

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Mar 28 '07 #1
4 1436
I don't believe you can via server side.

What you can do is create these elements serverside. Create a
placeholder on your page where you would like to insert the elements
and use the following code.

protected void addItems() {
TextBox t = new TextBox();
t.id = "myID";
Placeholder.Controls.Add(t);
}

protected void getItems() {
string s = myID.text;
}

Hope this helps.

Mar 28 '07 #2
On Mar 28, 8:13 pm, "Eric Layman" <namyalcire[at no spam]gmail.com>
wrote:
HI,

Im on dotnet 1.1

I've generated extra checkboxes, textboxes via client side javascript:

eg:
var inputElement = document.createElement('input');

inputElement.setAttribute('type', 'radio');...

inputElement.setAttribute('id', 'xx');

...

How do i capture these values via server side?
var el = document.createElement('input');
el.type='hidden';
el.value = someValue;
el.id='myEl';
theForm.appendChild(el);
....!
Then you can do (server side) stuff like:
string tmp = Request.Params['myEl'];

But in general terms you really shouldn't DO this...!!

Thomas

--
http://ajaxwidgets.com
ASP.NET 2.0 Ajax Widgets

Mar 28 '07 #3
you also need to set the postback name

el.name = 'myEl';

-- bruce (sqlwork.com)

Thomas Hansen wrote:
On Mar 28, 8:13 pm, "Eric Layman" <namyalcire[at no spam]gmail.com>
wrote:
>HI,

Im on dotnet 1.1

I've generated extra checkboxes, textboxes via client side javascript:

eg:
var inputElement = document.createElement('input');

inputElement.setAttribute('type', 'radio');...

inputElement.setAttribute('id', 'xx');

...

How do i capture these values via server side?

var el = document.createElement('input');
el.type='hidden';
el.value = someValue;
el.id='myEl';
theForm.appendChild(el);
...!
Then you can do (server side) stuff like:
string tmp = Request.Params['myEl'];

But in general terms you really shouldn't DO this...!!

Thomas

--
http://ajaxwidgets.com
ASP.NET 2.0 Ajax Widgets
Mar 28 '07 #4

"Thomas Hansen" <po*******@gmail.comwrote in message
news:11*********************@b75g2000hsg.googlegro ups.com...
On Mar 28, 8:13 pm, "Eric Layman" <namyalcire[at no spam]gmail.com>
wrote:
>HI,

Im on dotnet 1.1

I've generated extra checkboxes, textboxes via client side javascript:

eg:
var inputElement = document.createElement('input');

inputElement.setAttribute('type', 'radio');...

inputElement.setAttribute('id', 'xx');

...

How do i capture these values via server side?

var el = document.createElement('input');
el.type='hidden';
el.value = someValue;
el.id='myEl';
theForm.appendChild(el);
...!
Then you can do (server side) stuff like:
string tmp = Request.Params['myEl'];

But in general terms you really shouldn't DO this...!!

Thomas

--
http://ajaxwidgets.com
ASP.NET 2.0 Ajax Widgets

----- Original Message -----
From: "Thomas Hansen" <po*******@gmail.com>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Thursday, March 29, 2007 2:36
Subject: Re: how to grab values from javascript generated items?

On Mar 28, 8:13 pm, "Eric Layman" <namyalcire[at no spam]gmail.com>
wrote:
>HI,

Im on dotnet 1.1

I've generated extra checkboxes, textboxes via client side javascript:

eg:
var inputElement = document.createElement('input');

inputElement.setAttribute('type', 'radio');...

inputElement.setAttribute('id', 'xx');

...

How do i capture these values via server side?

var el = document.createElement('input');
el.type='hidden';
el.value = someValue;
el.id='myEl';
theForm.appendChild(el);
...!
Then you can do (server side) stuff like:
string tmp = Request.Params['myEl'];

But in general terms you really shouldn't DO this...!!

Thomas

--
http://ajaxwidgets.com
ASP.NET 2.0 Ajax Widgets
Hi Thomas,

Thanks for the reply.

May I know why not? Sometimes they may be instances which we may have to
generate extra table rows or mayb extra textboxes on the fly.

Im curious whether dotnet catered for these situations and perhaps there's a
nice built in widget to do the validations for these on the fly controls! =)

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Mar 28 '07 #5

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

Similar topics

1
by: GIMME | last post by:
If I have : <input name="a1" value="1"> <input name="a2" value="3"> <input name="a3" value="2"> And I want the user to enter the values 1,2, and 3 but not necessarily in that order .... (The...
0
by: Newasps | last post by:
Hi guys, I have a problem with UpdateCommand Event. In tihs event Ä°'m creating required controls to get that controls' values and also get them. But when I try to get updated values I'm getting the...
0
by: Ozer | last post by:
Hi guys, I need some help. In my datagrid's updatecommand event i'm trying to get textboxes values and also do it. But when i update the values in textboxes and fire the event, I can't get the...
6
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I...
0
by: Boris | last post by:
When I dynamically create CheckButtonList, I add ListItem(s) to my CheckButtonList object chkList chkList.Items.Add(new ListItem("My Text", "My Value")); The resulting HTML doesn't contain...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
8
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the...
1
by: kenny8787 | last post by:
Hi, can anyone help here? I have the following code generated from a database, I want to have javascript calculate the costs of the selected items using radio buttons, subtotal the costs and...
7
by: jodleren | last post by:
Hi all! I have a problem - I have a list of checkboxes, with certain data... the point is, that some of them are set, and the important thing for mere is to get those values, which have changed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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...

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.