Javascript for keyCode to Numeric Validation to a TextBox

 In Page Load of c# asp .net

TextBox1.Attributes.Add
("onKeyDown", "if((event.keyCode >= 48 && event.keyCode <= 57)||(event.keyCode >= 96 && event.keyCode <= 105)||(event.keyCode == 8 ) ||(event.keyCode == 9) || (event.keyCode == 12) || (event.keyCode == 27) || (event.keyCode == 37) || (event.keyCode == 39) || (event.keyCode == 46) )
{return true;}else{return false;}");