Hi Chris,
If you are dynamically creating these form fields, you will not
be able to access their values through Viewstate. Furthermore, if
you're creating them on the client side, the runat="server" directive is
useless because you're already beyond the server.
Your loop code below can be modified as follows:
for (int i = 1; i<textFieldCount;++i) {
string str, test;
str = "text_" + i;
test = Request.Form(str);
Response.Write("Output = " + test + "<br>");
}
Cheers,
Peter
-----Original Message-----
From: christopher andrada [mailto:[EMAIL PROTECTED]
Hi All,
I have a javascript function that generates an input
field within a form call Test. Each time an event
gets activated, the javascript function creates an
input field.
<input type="text" name="text_1" id="text_1"
runat="server">
<input type="text" name="text_2" id="text_2"
runat="server">
<input type="text" name="text_3" id="text_3"
runat="server">
.
.
.
.
.
etc...
<input type="hidden" name="textFieldCount"
id="textFieldCount" runat="server">
My problem is when the user click on a ASP.net Submit
button, how will I get each value from each input
field that was dynamically genenrated by my javascript function.
Note: I tried
for (int i = 1; i<textFieldCount;++i) {
string str, test;
str = "text_" + i;
test = str.Value;
Response.Write("Output = " + test + "<br>");
}
This will not work because str is a "String" not an
TextField object. Please let me know on how to solve
this problem.
Sincerely,
Chris Andrada
------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/