Q:

How to set the default error message

I have a nullable int field as follows. Obviously this is not a required field.
[DisplayName("Previous Job No:")]
public int? previousJobId { get; set; }

At the moment, if user input is invalid, it shows default error message The field Previous Job No: must be a number. 
How can I change this default error message using data annotations?
Thanks !

A:

What if you did:
[DataType(DataType.Int32, ErrorMessage = "Custom Error Msg")]
public int? previousJobId { get; set; }

Unfortunately, I am unable to test this atm.
Second Attempt:
This is not pretty, but it will save you from having to create a custom data annotation.  Which in turn, saves you from having to write custom jQuery validation.  I was able to test this and it worked for me.  But, it's up to you if you like the style.
[DisplayName("Previous Job No:")]
[RegularExpression("^[0-9]+$", ErrorMessage = "Custom Error Msg")]
public string previousJobId { get; set; }
private int? _previousJobId2;
public int? previousJobId2
{
    get
    {
        if (previousJobId == null)
        {
            return null;
        }
        else
        {
            return Int32.Parse(previousJobId);
        }
    }
    set
    {
        _previousJobId2 = value;
    }
}

You can test it in the Controller with:
[HttpPost]
public ActionResult Index(HomeViewModel home)
{
    if (ModelState.IsValid)
    {
        int? temp = home.previousJobId2;
    }
    return View(home);
}

You will reference the string in the View
@Html.LabelFor(model =>model.previousJobId)

