Is it possible to make a control array in ASP similiar to
a control array in VB? I am trying to show a table that
displays several fields for different people. My goal is
to try to allow the user to update several fields in the
database without have to press an update button after
every update.

The number of people in the database could be from 1 -
1000. Here is a quick sketch of what I want to do.



code:-----------------------------------------------------
---------------------------

Name Favorite Color Birthday
Mike Smith Blue 10/7/82
Jim Beam Red 9/15/90


--Update Button--


----------------------------------------------------------
----------------------


When the update button is pressed I want to be able to
update the changes to both Mike and Jim. It just seems
repetitive to keep pressing update for each user. I don't
think it would be hard if I could make the favorite color
and birthday text boxes an array. Is this possible? If
not, have any other suggestions?

The other thing that I was thinking of is creating the
text boxes for each field in a for loop like this:



code:-----------------------------------------------------
---------------------------
for i = 1 to 2
response.write "<INPUT type="text" name=color" & i
& ">"
next
----------------------------------------------------------
----------------------


This would generate a color1 and color2 text box. But the
problem I ran into is that I can request these values.
Here is the code I tried:


code:-----------------------------------------------------
---------------------------

for i = 1 to 2

data = "color" & i
data = Request(data)

response.write "!" & data & "! <BR>"

next

----------------------------------------------------------
----------------------


All that was printed on the screen was two sets of !!.
The request wouldn't work when I used a variable instead
of a constant.

Any suggestions would be greatly appreciated. Thanks for
the help.

Re: ASP Text Box Array by Ray

Ray
Fri Dec 26 13:33:49 CST 2003

There isn't a way to bind form elements together with indexes like that in a
web page or in the ASP processing, but what you're trying to do should do
the same thing. As far as your blank values, that'll typically happen if
you have a typo or something. You have some syntax errors in your code, and
you're trying to get your values from your request by using the ambiguous
request("name") instead of request.form("name") (or querystring, cookies,
etc.). Try this instead:


<form method="post" action="yourpage.asp">
<%
for i = 1 to 2
response.write "<INPUT type=""text"" name=""color" & i & """>"
next
%>
<input type="submit">



yourpage.asp:
<%
for i = 1 to 2
data = "color" & i
value= Request.FORM(data)

response.write "!" & value & "! <BR>"
next

Response.Write "<hr>"
For each thing in Request.Form
Response.Write thing & " = " & request.form(thing) & "<br>"
next
%>


That second part with the "for each thing" will show you all the form values
being posted.

Ray at work

"Jonathan" <anonymous@discussions.microsoft.com> wrote in message
news:00c701c3cbd6$6376b630$a101280a@phx.gbl...
> Is it possible to make a control array in ASP similiar to
> a control array in VB? I am trying to show a table that
> displays several fields for different people. My goal is
> to try to allow the user to update several fields in the
> database without have to press an update button after
> every update.
>
> The number of people in the database could be from 1 -
> 1000. Here is a quick sketch of what I want to do.
>
>
>
> code:-----------------------------------------------------
> ---------------------------
>
> Name Favorite Color Birthday
> Mike Smith Blue 10/7/82
> Jim Beam Red 9/15/90
>
>
> --Update Button--
>
>
> ----------------------------------------------------------
> ----------------------
>
>
> When the update button is pressed I want to be able to
> update the changes to both Mike and Jim. It just seems
> repetitive to keep pressing update for each user. I don't
> think it would be hard if I could make the favorite color
> and birthday text boxes an array. Is this possible? If
> not, have any other suggestions?
>
> The other thing that I was thinking of is creating the
> text boxes for each field in a for loop like this:
>
>
>
> code:-----------------------------------------------------
> ---------------------------
> for i = 1 to 2
> response.write "<INPUT type="text" name=color" & i
> & ">"
> next
> ----------------------------------------------------------
> ----------------------
>
>
> This would generate a color1 and color2 text box. But the
> problem I ran into is that I can request these values.
> Here is the code I tried:
>
>
> code:-----------------------------------------------------
> ---------------------------
>
> for i = 1 to 2
>
> data = "color" & i
> data = Request(data)
>
> response.write "!" & data & "! <BR>"
>
> next
>
> ----------------------------------------------------------
> ----------------------
>
>
> All that was printed on the screen was two sets of !!.
> The request wouldn't work when I used a variable instead
> of a constant.
>
> Any suggestions would be greatly appreciated. Thanks for
> the help.