日期:2014-05-18  浏览次数:20437 次

如何后台设置客户端文本框为只读属性?
前台定义了一个客户端的文本框, <input   id= "txt_EName "   type= "text "   maxLength= "25 "   name= "txt_EName "   runat= "server "> ,现在我要在后台设置他的属性为只读,这段代码该怎么写啊?谢谢!(c#.net)

------解决方案--------------------
什么客户端文本框?混淆视听。只要有Runat= "Server ",就是服务器控件。

你可以写:

txt_EName。Attributes[ "readonly "]= "readonly ";

取消它,可以写:

txt_EName。Attributes.Remove( "readonly ");

我似乎从来没有用过这个玩意。我都是使用TextBox。