使文本框不可编辑 [英] Making Text box not editable

查看:230
本文介绍了使文本框不可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C#的asp.net工作VS 05。我有一个需要量,我必须填写文本框与GridView的一些数据,这是从数据库中来,使其只读

在用户无法进入在GridView的模板字段的任何文字。如果我设置文本​​框已启用=假,然后我失去了文字的颜色,但我想显示的文字颜色。只是文本框无法编辑。我只是希望用户不能够在我的文本写什么。

After that user can not enter any text on gridview template field. If I set textbox Enabled=false, then i lose text color, but i want to show text color. Just textbox to not be editable. I just want users to not be able to write anything in my textbox.

推荐答案

是不是有一个只读属性的文本框中。

Isn't there a readonly property for the text box.

如果那么你可以使用

只读=真

文本框。

如果你的使用标签,然后我会preFER那一个。

If you can use a label then I would prefer that one.

有关,您可以使用一个标签里面包裹的内容

For wrapping contents inside a label you can use

自动换

word-wrap: break-word

里面的属性选择你的列字段和属性。

Inside the properties choose your column field and in the properties.

样式部分

您可以给一个的CssClass 以列。

如果您指定的CssClass为文字样式

If you specify CssClass as 'TextStyle'

的CSS看起来像这样

.TextStyle
{
    color: #a9a9a9
}

在颜色属性给无论是颜色名称,如红色或十六进制code像'#000000'的文本。

In the color attribute give either the color name like 'red' or the hexcode like '#000000' for the text.

这篇关于使文本框不可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆