Just ran into this problem today. I had a page which was running under .net 1.1
This page had a textbox which was set in the aspx page to readonly=true. there was a 2nd page which was changing the value of the text using some javascript. This all worked.
When i upgraded to .net 2.0 though i ran into problems. The text of the box would appear to change, but the value that actually came through was the original default value. My client side validation passed, but the server side did not since it was still seeing the default value. Turns out that setting the textbox to readonly really is readonly :)
You can work around this issue by not setting readonly in the aspx file. Instead go into your codebehind and use TextBoxID.Attribute("readonly") = true - you'll now have a text box that the user can't (easily) change but you can still change the value of the textbox in your code using javascript.
No comments:
Post a Comment