TextBox的Enabled问题

来源:互联网 发布:装修房子软件 编辑:程序博客网 时间:2024/04/29 08:14
如果设置TextBox的Enabled为false后,在后台用Text只能取得服务器端发送的值,比如
<asp:textbox id="t1" runat="server" Text="abc" Enabled="false" />
上面t1,在后台通过t1.Text,永远是取到abc,不管在前台怎么修改都是
解决方法:
1、不用Enabled="false",改用:
t1.Attributes.Add("disabled","disabled");

2、不用t1.Text取值,改用Request.Form["t1"]来取值。
原创粉丝点击