Question: Goal:
Validate input data in my e-formulary.

Question:
What syntax code (dataannotations) do I need to ensure that data is int or decimal?

Answer: 
The default model binder should handle validation automatically if you have specified your properties as int or decimal. You should get the following validation error if an incorrect value is entered:

```
public class MyObject
{
    public int MyProperty { get; set; }
}

The value 'i am a string' is invalid for MyProperty.

```

If you would like to do further validation such as only allowing certain ranges or formatting then you could use the [RangeAttribute](http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.requiredattribute%28v=vs.95%29.aspx) or the [RegularExpressionAttribute](http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.regularexpressionattribute%28v=vs.95%29.aspx) attributes.

```
[RegularExpression(@"\d+", ErrorMessage="MyProperty must be an int.")]
public int MyProperty { get; set; }

[Range(typeof(Decimal), "20", "25")]
public decimal MyProperty { get; set; }

```
Maybe I'm not understanding the question. For data type validation, simply have the property on your model be of the desired type (int or decimal).