Not Able to Retrieve Value in A Text box if it is Read only and is assigned as control to validate with Required Field Validator

Dear All,

Please help me to find a solution for this, it is a bug when the following condition is there.

I have a text box which is getting some values say [Employee name] from a popup window which is open, after binding the values to the text box, the popup dissappears [javascripts are written for this]. Till here it is okey

Basically the text box is readonly, and it is assigned as a control to validate control with a required field validator contol.


When ever some event [server event] occurs  I am not able to retrieve the value inside the text box. The value in the text box dissappears and the Required Field validator error messge is displayed in the web page.

The following code is what I have written ..

The code is not even working when Validation group is given.  Please Help .................

<asp:TextBox ID="txtsearch" runat="server" ReadOnly="true"></asp:TextBox>

<asp:RequiredFieldValidator ID="reqValidation" runat="server" ControlToValidate="txtsearch">PLEASE SEARCH </asp:RequiredFieldValidator>



5/16/2008 7:24:07 AM 93655 articles. 4 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 10

Buddy! this is one of the many headaches with ASP.Net 2.0

Use this to solve ur issue

<input type="text" id="txtsearch" runat="server" size="10" readonly="readonly" />

<asp:RequiredFieldValidator ID="reqValidation" runat="server" ControlToValidate="txtsearch">PLEASE SEARCH </asp:RequiredFieldValidator>

Access the textbox value by using "txtsearch.Value" on the server side.

This works without any issues :)


5/16/2008 8:09:26 AM

Thanks Rajesh... It Solved the entire Problem.

But may I know Why this is coming and what are the possible solutions for it to handle with asp itself. 


5/16/2008 9:53:21 AM

hello buddy ,

u can use asp textbox as well u just need to add

textbox1.attributes.add("readonly","readonly") instead of directly readonly=true

 and when u need to remove readonly then do


5/16/2008 9:59:46 AM

Web resources about - Not Able to Retrieve Value in A Text box if it is Read only and is assigned as control to validate with Required Field Validator -

CSE HTML Validator for Windows (Official Site) - Powerful HTML Validator, XHTML Validator, CSS Validator ...
CSE HTML Validator is a powerful and easy to use offline HTML, XHTML, CSS, JavaScript, and PHP syntax checker, HTML validator, XHTML validator, ...

DNSSEC/TLSA Validator is a web browser add-on which allows you to check the existence and validity of DNS Security Extensions (DNSSEC) records ...

Feed Validator for Atom and RSS
F E E D Validator for Atom and RSS and KML Jump to navigation RSS Profile Support Added ( more ) Home · About · News · Docs · Terms Copyright ...

iValidCard - Credit Card and Debit Card Number Validator on the App Store on iTunes
Get iValidCard - Credit Card and Debit Card Number Validator on the App Store. See screenshots and ratings, and read customer reviews.

Not fare: new myki card validators lack account balance information
New myki card validators will not tell passengers what their fare is, nor their account balance, leaving unable to monitor their myki use as ...

Mozilla launches new JavaScript-based Add-ons Validator for developers
... that the validation tool provided by Mozilla is unreliable and difficult to use. Today the company announces that the old Python-based validator ...

Business Insider Built An Awesome Analytics Validator And You Can Use It
At a fast-growing media company like Business Insider, keeping accurate analytics is absolutely essential. Editors rely on our analytics dashboard ...

Jon Voight, Validator of Right-Wing Frenzy
Jon Voight was once known for his acting chops and, later, for fathering Angelina Jolie. These days? Well, he's known for his rabid right-wing ...

chriso/validator.js · GitHub
validator.js - String validation and sanitization

Bing Webmaster Tools Adds Markup Validator
The Bing Webmaster Blog announced they have added a new feature to the crawl section named Markup Validator. To access this new feature, login ...

Resources last updated: 11/27/2015 1:12:18 AM