I am a beginner of .NET coding.
How can we give validation for a text box in which only positive integers are allowed?
Use the Range attribute on your Model property:
[Range(0, int.MaxValue)]
public int YourNumber { get; set; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With