Re: how to lock a textbox

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Moondaddy,

Any further question on this? If so, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------


Thanks for your prompt response Moondaddy,

Yes, I know your concern here. And the "readonly" html attribute or
"ReadOnly" server control property does help make the textbox prevent from
user inputting and display readonly content without gray them. Is there
anything else prevent you from using this option?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: "moondaddy" <moondaddy@xxxxxxxxxxxxxxxx>


That's a step in the right direction, however, I don't want the user to
be
able to type in it, otherwise, they will think they are allowed to do so.

I
want it read-only - locked similar to a windows textbox. The problem
with
setting enabled=false is that the text is not clear and is more difficult
to
read.

Thanks.

"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:83Tqk236HHA.4200@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Moondaddy,

As Mike has suggested, TextBox can be set to readonly mode(in addition
to
disabled) which will remain the eabled look style.

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

<input type="text" readonly="true" />
===================

Does thie fit your scenario?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
From: "Mike" <Mike@xxxxxxxxxxxxxxxxxxxx>


you can make it readonly.

textbox.Readonly = true;

that will give it the normal look like you can type in it, rather then
the
gray look that disabling it does.


"moondaddy" <moondaddy@xxxxxxxxxxxxxxxx> wrote in message
news:e2CAbTz6HHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
I have a textbox on a webform and based on certain conditions I wanted
to
prevent a user from editing its text. I dont like the look of the
texbox
when its disabled and was wondering if there is a different way to lock
it
with how hiding it and creating a label to look just like it. I was
also
going to do this server side.

Thanks.

--
moondaddy@xxxxxxxxxxxxxxxx











.



Relevant Pages