in asp.net with C# code in textbox field want to type only numbers not characters
please help me.please send code.
Thanks,
Narasiman P
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Jun 20, 2012, 2:34 AM
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Number_Chracter_validation._Default" %>
Thanks
Jignesh TrivediPosted Jun 20, 2012, 2:15 AM
you can acheive same using Java script
Javascript code
function allowNumeric(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
Text Box Declaration.
Also Refer
http://www.codeproject.com/Articles/11006/TextBox-which-accepts-only-numbers
http://www.codeproject.com/Tips/328178/Allow-only-Numeric-values-in-ASP-Text-box-control
hope this will help you.
Santhosh Kumar JayaramanPosted Jun 20, 2012, 1:58 AM