471,873 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 2891
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
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

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.