i want only numeric value enter in textbox, i am using this way but doesnt work
@Html.TextBoxFor(i => i.pincode, new { @placeholder = "Pincode", @class = "txt-small", @maxlength = 6, @type = "number" })
i want only numeric value enter in textbox, i am using this way but doesnt work
@Html.TextBoxFor(i => i.pincode, new { @placeholder = "Pincode", @class = "txt-small", @maxlength = 6, @type = "number" })
Know the answer? Post it. Somebody with the same question will find it here.
Jignesh KumarRank #91 · 22.9K reputationPosted May 5, 2022, 4:46 AM EDT
Guest UserRank #3,125 · 458 reputationPosted May 5, 2022, 7:48 AM EDT
Guest UserRank #3,125 · 458 reputationPosted May 5, 2022, 5:41 AM EDT
Amit MohantyRank #112 · 20K reputationPosted May 5, 2022, 5:46 AM EDT
Hey, if you want pincode validation try this
[RegularExpression(@"^\d{6}(-\d{4})?$", ErrorMessage = "Please Enter Valid Pin Code.")] public string Pincode { get; set; }Jignesh KumarRank #91 · 22.9K reputationPosted May 5, 2022, 7:15 AM EDT
@Scripts.Render("~/bundles/jqueryval") [MaxLength(12)] [MinLength(1)] [RegularExpression("^[0-9]*$", ErrorMessage = "Pincode must be numeric")] public string Pincode{ get; set; }Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts