Enter Only Amount In Text Box

If you want to restrict your text box for accepting only numeric value then try this code

Create a script function :-


function enterAmount(eve) {

            try {
                
                var val1 = (eve.which) ? eve.which : event.keyCode
                if (val1 > 31 && (val1 < 48) || (val1 > 57)) {
                    return false;
                }
            }
            catch (err) {
                alert(err);
            }


use this code in your code behind page :-

txtPaidAmount.Attributes.Add("onKeyPress", "javascript:return enterAmount(event);");
Ebook Download
View all
Learn
View all