15. May 2013
Asp.Net , C#
Are you expecting a required field validator will fire on your empty textbox field (textbox with readonly property)? Well, it will not fire. You need to refer the behavior of asp.net validators. Required field validator is disabled for readonly inputs. But still you have a scenario where you want to keep your input field as readonly and also required field validator.
Well, the simplest way is to avoid the making inputs readonly in html/aspx code. Rather than that use Page Load event to make them readonly. In Page Load event, we can simply add readonly attribute as –