手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >asp.net TextBox控件设置ReadOnly后,不能回传。
asp.net TextBox控件设置ReadOnly后,不能回传。
摘要:很奇怪,以前都没有过这样的怪问题,在别人机器上都能正常,想到可能和ASP.NET的版本有关系。我用的是ASP.NET2.0,当改成ASP.N...

很奇怪,以前都没有过这样的怪问题,在别人机器上都能正常,想到可能和ASP.NET的版本有关系。

我用的是 ASP.NET 2.0,当改成 ASP.NET 1.0,就正常了,TextBox控件ReadOnly=True,能回传。

在 ASP.NET 1.0 中是ReadOnly=True会回传的。

在 ASP.NET 2.0 中是ReadOnly=True就不会回传了。

解决的方法:

<asp:textbox id="Username" runat="server" ReadOnly="True"></asp:textbox>

去掉ReadOnly="True",改成

<asp:textbox id="Username" runat="server"></asp:textbox>

在后台代码中加入,控制只读属性

Username.Attributes.Add("Readonly", "True");

这样在 ASP.NET 2.0 中只读的TextBox控件也能实现回传。

【asp.net TextBox控件设置ReadOnly后,不能回传。】相关文章:

asp.net neatUpload 支持大文件上传组件

asp.net 操作excel的实现代码

asp.net 文件上传实例汇总

Asp.net(C#)文件操作函数大全

asp.net(c#) RSS功能实现代码

asp.net中使用cookie传递参数的方法

asp.net request.PathInfo实现的url重写

asp.net Repeater绑定时使用函数

asp.net Repeater中使用if的代码

asp.net下中文验证码,免费开源代码

精品推荐
分类导航