Thanks for the reply, Brian. Prior to your post I had tried:
string x = ((TextBox)this.FindControl(id)).Text;
which didn't work. Changing "this" to "Page" didn't help either.
Since these, Rows, Cells and textboxes are being added to an empty table that is defined on the page, I also tried: string x = ((TextBox)table1.FindControl(id)).Text;
The error message generated with these attempts was:
"Object reference is not set to an instance of an object"
This error message can be a bit ambigueous at times because you don't know if you've coded the statement improperly or if the data that you're trying to access is really not there. I suspect that the latter in this case.
I did see a couple of forums explaining that controls that are created dynamically are not automatically added to the viewstate and therefore would not appear in postback. One remedy I saw was to generate the row, cell and textbox add's from the OnInit() function rather than Page_Load().
My most recent attempt was to have my AddRows() function called from OnInit() rather than Page_Load(), but that resulted in the same error. While debugging, I see that the count in the table1.rows property is 0, so I'm pretty sure that the rows aren't being persisted to my code-behind.
If I find the answer I'll post it. Thank you for your help.
Bob
|