Hello,
I have a series of variables ending with a number and am trying (unsuccesfuly) to put them in a table using For Next loop.
the code looks like this:

<%
v1 =  "text_1"
v2 =  "text_2"
v3 =  "text_3"
%>
<table border="1">
<%
For x = 1 To 3
response.write("<tr ><td>text "&x&"</td><td>"&v+x&" </td></tr>")
next
%>
</table>

Any help much appreciated.

minbor

Recommended Answers

All 3 Replies

I do not really sure if this is what you want but in aspx i do this.

foreach (Control cd in form1.Controls)
            {
                if (cd.GetType().Name == "TextBox")
                {
                    TextBox txt = (TextBox)cd;
                    txt.Text = "hello";
                }
            }

regards

Hi
try this

<%
v1 =  "text_1"
v2 =  "text_2"
v3 =  "text_3"
%>
<table border="1">
<%
For x = 1 To 3

response.write("<tr ><td>text "&x&"</td><td>"& "v" & x &" </td></tr>")
next
%>

gavo0

Thanks for the replies but this does not exactly do whats needed. The result I'm looking for is a table like

____________
| v1 | text_1 |
| v2 | text_2 |
| v3 | text_3 |
-----------------

Thanks for the help

minbor

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.