title: Show validation message for razor view for input type number but model attribute string
body: <p>I have a string field in my modal class where users will have to enter numbers between 1-8 only.
  Modal class attribute:</p>
  <pre><code>[MaxLength(1)]
  [MinLength(1)]
  [Required(ErrorMessage = &quot;Please enter correct value&quot;)]
  public string RoomNumber { get; set; }
  </code></pre>
  <p>This input is asked in view page as::</p>
  <pre><code>&lt;div class=&quot;form-group&quot;&gt;
  @Html.LabelFor(model =&gt; model.RoomNumber, htmlAttributes: new { @class = &quot;col-md-12&quot; })
  &lt;div class=&quot;col-md-12&quot;&gt;
      @Html.EditorFor(model =&gt; model.RoomNumber, new { htmlAttributes = new { @class = &quot;form-control input-digit&quot;, @type = &quot;number&quot;, @min = &quot;1&quot;, @max = &quot;8&quot; } })
      @Html.ValidationMessageFor(model =&gt; model.RoomNumber, &quot;&quot;, new { @class = &quot;text-danger&quot; })
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <ol>
  <li><p>I want to print validation message for the user if they enter incorrect value, I mean to show error message if they enter value greater than 8.</p>
  </li>
  <li><p>Also can I restrict user input between 1 - 8 digit number only? Is it possible?</p>
  </li>
  </ol>
  <p>I can not change the data type of <code>RoomNumber</code> attribute due to project restrictions.</p>
  <p>Thank You.</p>