开发者

TextBox Text is empty on postback

开发者 https://www.devze.com 2023-04-01 06:34 出处:网络
I have a problem that occures from tim开发者_运维问答e to time but I can\'t figure out the reason why it\'s happening.

I have a problem that occures from tim开发者_运维问答e 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号