Get input type = tag "number" to run on the server

I have two html5 input input elements on my page, and I would like to use their value through the code behind. but when I add the runat = "server" attribute, I still can't catch them in the cs file. is there any way to do this?

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
source share
2 answers

Microsoft has released an update for the .NET framework 4 that allows the TextBox to support HTML 5 attributes.

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

See Fonction 3

 <asp:TextBox runat="server" type="some-HTML5-type" /> 
+2
source

In your page load, you can simply add this:

  hour_input.Attributes.Add("type", "number"); 
0
source

Source: https://habr.com/ru/post/1487232/


All Articles