加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-16 07:01:25 所属栏目:asp.Net 来源:网络整理
导读:我读了很多关于这个的话题,但我也遇到了.NET 4.5上Textmode =“Time”属性的问题. 我在aspx方面有这个: asp:TextBox runat="server" ID="txtBoxStartTime" TextMode="Time"/asp:TextBox 在vb.net方面,当我尝试从这个文本框中获取Text值时,我只有空字符串(“
我读了很多关于这个的话题,但我也遇到了.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;
    }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读