By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,022 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,022 IT Pros & Developers. It's quick & easy.

How do I validate a ReadOnly Textbox using the RequiredFieldValida

P: n/a
Ian
I have an ASP.NET 2.0 page with a readonly textbox on it who's value is
populated by a popup child window used for selecting from a list. I use a
javascript function to pass the data back to the parent using the name of the
textbox with the parent form. This all works fine, except when I click Save
on the Parent form and require the client side RequiredFieldValidator to
trigger. This validator results in showing the error message pertaining to
the fact that the readonly textbox is empty

Any ideas

Much appreciated
Ian
Nov 2 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ian
To get around this I have used this code in the Page_Load event

txtTextbox.Attributes.Add("readonly", "true");

However, this appears to be a dirty hack to me

Is there another solution?

"Ian" wrote:
I have an ASP.NET 2.0 page with a readonly textbox on it who's value is
populated by a popup child window used for selecting from a list. I use a
javascript function to pass the data back to the parent using the name of the
textbox with the parent form. This all works fine, except when I click Save
on the Parent form and require the client side RequiredFieldValidator to
trigger. This validator results in showing the error message pertaining to
the fact that the readonly textbox is empty

Any ideas

Much appreciated
Ian
Nov 2 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.