如何在代码后面使文本框只读属性为false

本文关键字:文本 只读属性 false 代码 | 更新日期: 2023-09-27 18:12:48

我有一个文本框。我想使文本框只读属性在事件期间为true或false。

我通过下面的代码将TextBox readonly属性设置为true:

   txtNoOff.Attributes.Add("readonly", "readonly");

但是如何使文本框只读属性为false?我试过如下:

   txtNoOff.Attributes.Add("readonly", "false");

但是它不起作用。如何做到这一点?我需要你所有的建议。

如何在代码后面使文本框只读属性为false

删除readonly属性:txtNoOff.Attributes.Remove("readonly");

请尝试

txtNoOff.ReadOnly = false

Try

txtNoOff.Attributes.Remove("readonly");

Try

textBoxName.ReadOnly=true

False