Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 .NET 编码的初学者。
我们如何对只允许正整数的文本框进行验证?
Use the Range attribute on your Model property:
Range
[Range(0, int.MaxValue)] public int YourNumber { get; set; }