About the author

Vijay Kodali
E-mail me Send mail

Recent comments



The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2023

Java Script function to only allow integers in the textbox

Here is sample code for TextBox Validation to allow Numbers only.


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

function CheckTextBox(i)
    i.value = i.value.replace(/[^\d]+/g, '');



In Code behind add this function to "onkeyup" event for TextBox


TextBox1.Attributes.Add("onkeypress", "CheckTextBox(this)");


Posted by vijay on Wednesday, November 14, 2007 7:54 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Add comment

(Will show your Gravatar icon)

  Country flag

  • Comment
  • Preview