banana_split
asked on
asp.net required field validator - accept only numbers.
Hi,
I have a textbox controll and a required field validator field. How can i ensure that my textbox only allows the entry of numbers and not text?
Thanks
I have a textbox controll and a required field validator field. How can i ensure that my textbox only allows the entry of numbers and not text?
Thanks
ASKER
is there a way to control this using an expression on the validation controls instead?
you can use required field validator and the above code .
the above acode dose not allow to enter only digits
the above acode dose not allow to enter only digits
sorry
the above acode allow to enter only digits
the above acode allow to enter only digits
ASKER
Okay but where should i put the code at on the textbox control or on the required field validator? can you show me an example? thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
THANKS GOT IT!
ASKER
HI but there is a problem. it only works for Internet Explore, it does not work with firefox
onKeypress="if (event.keyCode < 46 || event.keyCode > 57) event.returnValue = false;"