Numeric textbox with Ajax in ASP.NET.
But we have now Ajax Extenders control available in asp.net and with just setting some property to the textbox and that it you text box now only accept Numeric value. Also we can set some Mask also like only date time format or some currency format.
Lets see how we can achieve this.
First download the AJAX control from here
Now unzip the downloaded files and add reference "AjaxControlToolkit.dll" to your project
Now add this line to you page directives
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
then place one text box in your web page and add extender like this
Similarly you can also masked the textbox value. Suppose you want to insert hyphen after 3 character and again after 2 character automatically when user typing the value you can achieve that also with this masked text box in as.net
Let's See an example.
The above example good to user where user can enter social security number.Similarly you can change the Mask property of the ajax extender depend upon your requirement.
And now you are done now it will accept only numeric value with maximum of 8 similarly you can also choose Datetime,Date,Time etc with this control.