如何锁定文本框 [英] how to lock a textbox
本文介绍了如何锁定文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在网络表单上有一个文本框,并根据我想要的某些条件
阻止用户编辑其文本。我不喜欢texbox的外观
当它被禁用时,并且想知道是否有不同的方法来锁定它
如何隐藏它并创建一个标签看起来只是喜欢它。我也是
去做这个服务器端。
谢谢。
-
mo*******@newsgroup.nosp am
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.
--
mo*******@newsgroup.nospam
推荐答案
你可以只读它。
textbox.Readonly = true;
会给它正常看起来你可以输入它,而不是那个禁用它的灰色外观。
" moondaddy" < mo ******* @ newsgroup.nospamwrote in message
news:e2 ************** @ TK2MSFTNGP05.phx.gbl ...
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" <mo*******@newsgroup.nospamwrote in message
news:e2**************@TK2MSFTNGP05.phx.gbl...
>我在网络表单上有一个文本框,并根据某些条件我想阻止用户编辑其文本。我不喜欢texbox的外观
当它被禁用时,并想知道是否有一种不同的方式来锁定它
隐藏它并创建一个看起来像它的标签。我也打算做这个服务器端。
谢谢。
-
mo ******* @ newsgroup.nosp am
>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.
--
mo*******@newsgroup.nospam
你好Moondaddy,
正如迈克建议的那样,TextBox可以设置为只读模式(除了
禁用)仍然是有效的外观风格。
===========
< asp:TextBox ID =" MyTextbox1" RUNAT = QUOT;服务器" ReadOnly = true>< / asp:TextBox>
< input type =" text"只读= QUOT;真" />
===================
这适合你的情景吗? />
此致,
Steven Cheng
Microsoft MSDN在线支持主管
该帖子按原样提供。没有保证,也没有赋予任何权利。
--------------------
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.
--------------------
>来自:" Mike" <弥** @ community.nospam.com>
>From: "Mike" <Mi**@community.nospam.com>
>
你可以只读它。
textbox.Readonly = true;
会给你正常的外观,就像你可以输入它,而不是那种禁用它的灰色外观。
" moondaddy" < mo ******* @ newsgroup.nospamwrote in message
新闻:e2 ************** @ TK2MSFTNGP05.phx.gbl ...
>
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" <mo*******@newsgroup.nospamwrote in message
news:e2**************@TK2MSFTNGP05.phx.gbl...
>>我在webform上有一个文本框,并根据某些条件我想阻止用户编辑其文本。我不喜欢texbox的外观
当它被禁用时,想知道是否有不同的方法来锁定
>>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
>>隐藏它并创建一个看起来像它的标签。我也打算做这个服务器端。
谢谢。
-
mo ******* @ newsgroup.nosp am
>>with how hiding it and creating a label to look just like it. I was also
going to do this server side.
Thanks.
--
mo*******@newsgroup.nospam
这是朝着正确方向迈出的一步,但是,我不希望用户能够输入它,否则,他们会认为他们是允许这样做。我想要它只读 - 锁定类似于Windows文本框。
设置启用= false的问题是文本不清楚并且更难以读取
。
谢谢。
" Steven Cheng [MSFT]" < st ***** @ online.microsoft.com写信息
news:83 ************** @ TK2MSFTNGHUB02.phx.gbl ...
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]" <st*****@online.microsoft.comwrote in message
news:83**************@TK2MSFTNGHUB02.phx.gbl...
您好Moondaddy,
正如迈克建议的那样,TextBox可以设置为只读模式(除了
禁用)这仍然是一种有效的外观风格。
===========
< asp: TextBox ID =" MyTextbox1" RUNAT = QUOT;服务器" ReadOnly = true>< / asp:TextBox>
< input type =" text"只读= QUOT;真" />
===================
这适合你的情景吗? />
此致,
Steven Cheng
Microsoft MSDN在线支持主管
此帖子按原样提供。没有保证,并且不授予
权利。
--------------------
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.
--------------------
>>来自:" Mike" <弥** @ community.nospam.com>
>>From: "Mike" <Mi**@community.nospam.com>
>>
你可以把它变为只读。
textbox.Readonly = true;
" moondaddy" < mo ******* @ newsgroup.nospamwrote in message
新闻:e2 ************** @ TK2MSFTNGP05.phx.gbl ...
>>
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" <mo*******@newsgroup.nospamwrote in message
news:e2**************@TK2MSFTNGP05.phx.gbl...
>>>我在网络表单上有一个文本框,并根据某些条件我想阻止用户编辑其文本。我不喜欢texbox的外观
当它被禁用时,想知道是否有不同的方法来锁定
>>>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
>>>隐藏它并创建一个看起来像它的标签。我也打算做这个服务器端。
谢谢。
-
mo ******* @ newsgroup.nosp am
>>>with how hiding it and creating a label to look just like it. I was also
going to do this server side.
Thanks.
--
mo*******@newsgroup.nospam
这篇关于如何锁定文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文