title: Validating integer Input using a Mask (Asp .NET MVC 3.0)
body: <p>My Model :</p>
  
  <pre><code>public virtual int? NumberTest { get; set; }
  </code></pre>
  
  <p>My View</p>
  
  <pre><code>@Html.LabelFor(model =&gt; model.NumberTest)
  &lt;br /&gt;
  @Html.TextBoxFor(model =&gt; model.NumberTest)
  </code></pre>
  
  <p>I'm using <a href="http://digitalbush.com/projects/masked-input-plugin/" rel="nofollow">Masked Input Plugin</a>, so I have in my View :</p>
  
  <pre><code>$("#NumberTest").mask("99999-999");
  </code></pre>
  
  <p>My Html generated :</p>
  
  <pre><code>&lt;input data-val="true" data-val-number="The field NumberTest must be a number." id="NumberTest" name="NumberTest" type="text" value="" /&gt;
  </code></pre>
  
  <p>So it automatically generated a number validation on my Integer input... And I'm using a mask with non-integer char to format number.... </p>
  
  <p>This validatior is always called when I fill the input ... How can I fix that?</p>