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;
    }

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....