Friday, July 29, 2011

ReadOnly textbox loose changed information

As we know that when we declare a textbox as readonly then we didnot get value from that readonly textbox from code file. Because asp.net rejects any changes in readonly textbox after postback. Here in this article i will describe ASP.NET Read Only TextBox lose client side changes, values across post back? Why Readonly Text box values are empty in code behind ? Issue in Retrieving textbox value when readonly = true in codebehind.? The real thing is when you declare a textbox as readonly in design mode and assign a value using a javascript function then from code file you did not get the value in server side. Its a bug.Its a problem for developers. There is a workaround on this issue which i will share with you. The solution is simple.

Solution:
1. Dont assign readonly property=true in design mode.
2. Bind the readonly property from serverside page load event like: