Tuesday, May 02, 2006

ASP.NET: TextBox losing data on postback

Some may have encountered a problem where a TextBox may lose its data upon posting back although EnableViewState is set to true. Assuming the TextBox is not a password field (does not get saved for obvious reasons), there is one other reason that you don't see documented anywhere: if you carelessly copied your WebForm and forgot to update the codebehind path or the namespace!