By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,138 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

Capturing Data of Dynamically Created TextBox's

P: n/a
Hi there,

I am dynamically created a table at runtime on an aspx form. The last
cell of each row contains a TextBox in which the user will enter
numeric values into.

Each textbox I create is given a name such as myTextBox0, myTextBox1,
... etc Basically the index of the loop that creates the table is
appended to the end of each TextBox name (ID).

My Problem:

How do I capture the values in each text box once the user continues
(click button) to the next screen??

If you could possibily post me an example of how to do this I would be
most grateful.

Thanks in advance.
Nov 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
how do you move to the next page ?
if you use Server.Transfer you can use the Form collection:
Form["myTextBox0"]

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2

P: n/a

No I just have a button and within the button event I attempt to capture
the values. Can you please be more specific?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

P: n/a
On the same page ? by using the controls ID (just dont forget to
recreate them on post back) and the FindControl method :

string x = ((TextBox)this.FindControl("mytextbox1")).Text;

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4

P: n/a

but on postback isn't everything recreated? so the values within the
text box will be wiped?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #5

P: n/a
Yes, every thing recreated but the asp.net smart enough to change the
text box value to the value submitted from the client.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.