I have a textbox for card details which not only validates the card on each digit entered but also identifies the provider. I used jQuery to do this and prevent NaN's from being entered
$(function(){
$('.numeric').keypress(function(event) {
if (event.which != 8 && isNaN(String.fromCharCode(event.which))) {
event.preventDefault();
}
}
}
Now just add the class numeric to your control and voila!
If you're not using jQuery, start using it ^_^
Hope that helps
Andy