Capturing Data of Dynamically Created TextBox's

  • Thread starter Thread starter Jack Johnston
  • Start date Start date
J

Jack Johnston

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.
 
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
 
No I just have a button and within the button event I attempt to capture
the values. Can you please be more specific?
 
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
 
but on postback isn't everything recreated? so the values within the
text box will be wiped?
 
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
 
Back
Top