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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Blocked AccountRank #403 · 6.2K reputationPosted Dec 17, 2007, 6:17 PM EST
<asp:CompareValidator ID="CVOnlyInteger" runat="server" ErrorMessage="Values should be integer only" ControlToValidate="textBox1" Operator="DataTypeCheck" Type="Integer">asp:CompareValidator>
Happy Coding!!Sandilian Arumugam10 reputationPosted Dec 17, 2007, 6:25 PM EST
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);");
}
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 22, 2019, 5:55 AM EST