How to make textbox readonly property false in code behind?

寵の児 提交于 2019-12-11 10:23:44

问题


I have one TextBox. I want to make textbox readonly property true or false during an event.

I set the TextBox readonly property as true by the following code:

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

But how to make textbox readonly property false? I have tried like below:

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

But it does not work. How to achieve this? I need all ur suggestions please.


回答1:


Just remove the readonly attribute: txtNoOff.Attributes.Remove("readonly");




回答2:


please try

txtNoOff.ReadOnly = false



回答3:


Try

txtNoOff.Attributes.Remove("readonly");



回答4:


Try

textBoxName.ReadOnly=true

or False



来源:https://stackoverflow.com/questions/7937915/how-to-make-textbox-readonly-property-false-in-code-behind

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!