无法从只读或禁用的文本框控件asp.net获取值 [英] can't get value from readonly or disabled textbox control asp.net

查看:58
本文介绍了无法从只读或禁用的文本框控件asp.net获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下任何一种方法在asp.net中创建了不可编辑的控件

I created an uneditable control in asp.net using either of the folowing

<asp:TextBox ID="txtStartDate" runat="server" enabled="false"></asp:TextBox>
or
<asp:TextBox ID="txtStartDate" runat="server" readonly="true"></asp:TextBox>

am使用JavaScript弹出窗口填充客户端的文本框.当我尝试在代码隐藏中检索该值时,该值始终为空

am using a javascript popup to fill the textbox in the client side. the value is always null when i tried to retrieve it in codebehind

有人可以提出更好的方法吗

can anyone suggest a better way

推荐答案

尝试一下

<asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>

隐藏代码

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

详细了解如何在后面的代码中检索只读文本框的值

这篇关于无法从只读或禁用的文本框控件asp.net获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆