asp.net vb -- only enter numbers in textbox?

  • Thread starter Thread starter Jay W
  • Start date Start date
depends if you want to validate before a post back in which case you can use a regular expression validator on the page which prevents a post back before the correct data is submitted. (google this there are loads of examples)

or you can attach a javascript function to the checkbox itsself using the onkeypress event and then return false if the character is not numeric
 
use ascii character,
ascii character for 0 is 48 and for 9 is 56
so write condition that ascii char >=47 or <=56
 
Back
Top