Asp.Net Javascript Numeric Validation For Textbox

<script language=”javascript” type=”text/javascript”>

function isNumeric(keyCode)
{
if(keyCode==16)
isShift = true;
return ((keyCode >= 48 && keyCode <= 57 || keyCode == 8 ||
(keyCode >= 96 && keyCode <= 105)) && isShift == false);
}

</script>

Call Javascript function on onkeydown Event Of Textbox

<asp:TextBox ID=”txtAppealNo” runat=”server” onkeydown = “return isNumeric(event.keyCode);”></asp:TextBox>

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s