<script type=
"text/javascript"
>
function
setReadOnly()
{
var
TextBox1 = $find(
"<%= RadTextBox1.ClientID %>"
);
TextBox1._textBoxElement.readOnly =
state
;
}
function
clearReadOnly()
{
var
TextBox1 = $find(
"<%= RadTextBox1.ClientID %>"
);
TextBox1._textBoxElement.readOnly =
false
;
}
</script>
Using the above to toggle a textbox readonly flag. Setting back readonly = false and then entering a value into the textbox, upon postback the value is empty.
Question : How to toggle readonly flag client side and make control behave correctly upon postback?
*** Note: Here is the strange part, the control only fails (empty string) on the first postback - after that things work correctly.
More Info: On the first postback - the ReadOnly flag on the server side is false. So setting readonly to false in java-script did not update something and serverside the flag is still true. I think that why the value is empty.