Reputation: 650
I have a problem that occures from time to time but I can't figure out the reason why it's happening.
I have a txtFilter. I enter the value in textbox hit the asp:button that posts the form back to server and txtFilter.Text property is empty. The control where texbox resizes is added to the page dynamically but it depends on a request parameter so it's not the case that I'm not loadding some controls that were loaded before.
The strangest part in this situation is that even though txtFilter.Text is empty, Request[txtFilter.Text.UniqueID] has the value that I entered.
Any ideas?
Upvotes: 0
Views: 2849
Reputation: 3248
If you are dynamically creating/adding the textbox control you need to do it in page_init so it participates in the normal page event lifecycle. This link may help: http://support.microsoft.com/kb/317794
Request[controlid] will always contain the value that you entered since you are accessing the raw HTML form post data.
Upvotes: 3