4

I have two html5 input number controls on my page and I would like to use their value through code behind. but when I add the runat="server" attribute I still cannot catch them in the cs file. is there a way to do it?

here are my controls:

<input id="hour_input" type="number" min="1" max="12" step="1" value ="1" runat="server"/>
            <input id="minutes_input" type="number" min="0" max="60" step="5" value ="0" runat="server"/>

it gives: "the name 'hour_input' does not exist in the current context"

4

2 回答 2

2

Microsoft 发布了 .NET Framework 4 的更新,允许 TextBox 支持 HTML 5 属性。

http://support.microsoft.com/kb/2468871

功能 3

<asp:TextBox runat="server" type="some-HTML5-type" />
于 2013-06-20T08:08:15.927 回答
0

在您的页面加载中,您可以简单地添加以下内容:

 hour_input.Attributes.Add("type", "number");
于 2013-06-20T08:05:14.553 回答