hi!, i need the validation for a textbox( in c# or vb.net) so that it sholud take numerics only, though i give any character, it should not display it,
do i have any method ?or do i have to use Convert ot int .parse?
plz, help me
hi!, i need the validation for a textbox( in c# or vb.net) so that it sholud take numerics only, though i give any character, it should not display it,
do i have any method ?or do i have to use Convert ot int .parse?
plz, help me
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.
Mageshwaran RPosted Nov 22, 2019, 10:55 AM
Sandilian ArumugamPosted Dec 17, 2007, 11:25 PM
Hai Friend This might help you.
Client Side Validation
function isValidNumeric(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode >= 48 && charCode <=57 || charCode == 46)
{
return true;
}
return false;
}
protected
void Page_Load(object sender, EventArgs e){
txtAmount.Attributes.Add("onKeyPress","return isValidNumeric(event);");
}
Blocked AccountPosted Dec 17, 2007, 11:17 PM
<asp:CompareValidator ID="CVOnlyInteger" runat="server" ErrorMessage="Values should be integer only" ControlToValidate="textBox1" Operator="DataTypeCheck" Type="Integer">asp:CompareValidator>
Happy Coding!!