微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

asp.net – Text 4.5中的文本.NET 4.5中的Time属性在Code Behind中消失

我读了很多关于这个的话题,但我也遇到了.NET 4.5上Textmode =“Time”属性的问题.

我在aspx方面有这个:

<asp:TextBox runat="server" ID="txtBoxStartTime" TextMode="Time"></asp:TextBox>

在vb.net方面,当我尝试从这个文本框中获取Text值时,我只有空字符串(“”).

CDate(txtBoxStartTime.Text)

在客户端,在webInspector中我可以轻松地从文本框中获取值,但我需要在服务器端…

即使我尝试使用runat =“server”的HTML5标签,我也会遇到同样的问题.

我注意到问题与Framework 4.5上的所有Textmode属性相同

对此有何建议/解决方案?
我非常感谢您的投入!

谢谢!

解决方法

TextBoxMode Enumeration

SingleLine mode displays the TextBox control as a single row. If the
user enters text that exceeds the physical size of the TextBox
control,the text will scroll horizontally. MultiLine mode displays
the height of the TextBox based on the Rows property,and allows data
entry on multiple lines. The text will automatically wrap if the Wrap
property is set to true. If the user enters text that exceeds the
physical size of the TextBox,the text will scroll accordingly and
scroll bars will appear. The behavior of Password mode is similar to
SingleLine mode except that all characters entered in the TextBox
control are masked and are not saved in view state.

然后

The remaining options correspond to type attribute values for the
input element in the HTML5 specification.

因此,文本框的服务器端行为没有任何变化,以下代码按预期工作

标记

<asp:TextBox runat="server" TextMode="Time" ID="test"></asp:TextBox>
   <asp:Button runat="server" ID="btn" Text="ok" />

C#代码落后

protected void Page_Load(object sender,EventArgs e)
    {
      string value = test.Text;
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐