Render ASP.NET TextBox as HTML5 Input type “Number”

To render ASP.NET TextBox as HTML5 input type “Number”, set type="number" directly on the textbox.

Let us see an example of ASP.NET TextBox −

<asp:TextBox runat="server" type="number" />

You can also use the following dynamically created the control −

TextBox tb = new TextBox();
tb.Attributes.Add("Type", "number");

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 25-Jun-2020


Kickstart Your Career

Get certified by completing the course

Get Started