简体   繁体   中英

ASP.Net textbox will not postback on textchanged if set to false on pageload

I have a textbox with a regex validator attached to it and some stuff in the ontextchanged code behind. This all works fine unless I start the textbox out with Visible=false. Obviously, I'm setting the textbox.Visible to true later on in the codebehind, but when I do this, no postback occurs when the text changes. I'm pretty sure I have isolated the cause to when I change the visible property, but has anyone seen anything like this or know some sort of work around?

When you set a control's visible property to false it is not rendered on the page at all. If you simply want it to not display to the user you can use CSS.

Do you have AutoPostBack="true" set on the textbox?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM