I have a Panel on my Page:
<asp:Panel ID='pnlTest' runat='server' />
Then I dynamically add a TextBox to it on Page_Load:
TextBox simpleTextBox = new TextBox(); pnlTest.Controls.Add(simpleTextBox); simpleTextBox.ID = 'SimpleTextBox-1';
Is there a way to pull in the information typed in this TextBox without pulling it directly from Request.Form? I thought I could do something like this after I added it again:
lblPresentResults.Text = myTextBox.Text;
I know this example seems contrived, but I figured I’d try to eliminate all the other variables in my specific application, especially to ask a question here.
You need to add the textbox before viewstate loads, such as in Page_Init, and you should be able to do this.