469,330 Members | 1,199 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

How to pass multiple values in table to another form

Dev't Tool: Visual C# 2003 and Javascript
System Type: Web Application

One requirement of the system is to dynamically create a table on client-side (Javascripting using createElement method.) The table has textboxes inside each cell.

a few sample code:

Expand|Select|Wrap|Line Numbers
  1. for (i = 0; i < 4; i ++) // four columns
  2. {
  3.   textBoxes = document.createElement("INPUT");
  4.   textBoxes.type = "text";
  5.   textBoxes.id = "txt1";
  6.   textBoxes.name = "txtA";
  7.   cell.appendChild(textBoxes);
  8. }

These are my options to get the values:
1. Through querystring -> but not possible because there are many values to be passed.
(sample: WebForm2.aspx?value1=&value2)

2. Also tried getting it by Request.Form["txtA"]
I can get the values but it is comma delimited. I cannot get exact data when my input has "," in it.
(sample: Input1 = "a,b"; Input2= "c"; Request.Form["a,b,c"])
if to be split, 3 values will be returned instead of 2.

Maybe there's another option that you can suggest so I can retrieve those multiple data.

One more thing, I would like those data to be on one-time retrieval because in the INSERT process, I plan to include them on a loop inside a TRANSACTION statement so if one record encountered an error, all will ROLLBACK.
Nov 7 '08 #1
3 2795
acoder
16,027 Expert Mod 8TB
Firstly, IDs should be unique, so in the for loop use the index to give the unique ID strings. To avoid the problem of commas, you could rename the text boxes to make them unique.
Nov 9 '08 #2
Thanks for the reply. I solved the problem by using my 2nd option which I stated before (Request.Form["txtA"]).

I just created a function that replaces "," with "%2c" so that if a user tends to input a value with ",", the parser will not treat it as a delimiter, thus splitting the returned value accurately.
Jan 27 '09 #3
acoder
16,027 Expert Mod 8TB
Thanks for posting back with your solution.
Jan 27 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Steven Stewart | last post: by
1 post views Thread by colleen1980 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.