I want to disable the text box for the user.
But there is a value in the text box that I need to read.
So, I want a property readOnly(because I can read the value), but also want the gray window (function enabled = false) that the user sees, he does not have edit access to the text box.
readOnly
enabled = false
What is the best way to do this?
The @Keith attribute Readonlyfor the input field would be good. You can cut the text box by changing its background color.
Readonly
if your text box is html input text do the following:
<input id="Text1" type="text" value="read me" readonly="readonly" disabled="disabled" />
asp TextBox, :
<asp:TextBox ID="TextBox1" runat="server" ReadOnly ="true" Enabled="false"></asp:TextBox>
Use Label instead, why do you use TextBox if you want to open editing for the user, and also change the color of the Label control.
For me, the best way is to set the enabled = = property, but from jQuery:
$ ('# txtTotal') atr ('disabled', 'disabled') ;.
This way you can read the value in the code.