There is no explicit data annotation for a decimal so you need to use two separate ones to add constraints.
Two Decimal Points
[RegularExpression(@"^\d+(\.\d{1,2})?$")]
This regular expression will make sure that the property has at most two decimal places.
Max 18 digits
[Range(0, 9999999999999999.99)]
Assuming you aren’t accepting any negative numbers. Otherwise, replace 0
with -9999999999999999.99
.
Result
[RegularExpression(@"^\d+(\.\d{1,2})?$")]
[Range(0, 9999999999999999.99)]
public decimal Property { get; set; }