title: Use Model Display name for Blazor Validation message from Custom InputSelect
body: <p>As we know Blazor doesn't support Int option select for <code>&lt;InputSelect&gt;</code> (but support string &amp; Enum) and we get the following error message:</p>
  <p>Error: System.InvalidOperationException: Microsoft.AspNetCore.Components.Forms.InputSelect<code>1[System.Nullable</code>1[System.Int32]] does not support the type 'System.Nullable`1[System.Int32]'.</p>
  <p>Therefore, I write a <code>&lt;CustomInputSelect&gt;</code>:</p>
  <pre><code>public class CustomInputSelect&lt;TValue&gt; : InputSelect&lt;TValue&gt;
      {
          protected override bool TryParseValueFromString(string value, out TValue result, out string validationErrorMessage)
          {
              if (typeof(TValue) == typeof(int?))
              {
                  if (int.TryParse(value, out var resultInt))
                  {
                      result = (TValue)(object)resultInt;
                      validationErrorMessage = null;
                      return true;
                  }
                  else
                  {
                      result = default;
                      validationErrorMessage = $&quot;The {FieldIdentifier.FieldName} field is Required.&quot;;
                      return false;
                  }
              }
              else
              {
                  return base.TryParseValueFromString(value, out result, out validationErrorMessage);
              }
          }
      }
  </code></pre>
  <p>I have the following Model:</p>
  <pre><code>public class Risk : ICloneable
      {
          /// &lt;summary&gt;
          /// Associated Legal Entity of the risk
          /// &lt;/summary&gt;
          [Required]
          [Display(Name = &quot;Legal Entity&quot;)]
          public int? LegalEntityId { get; set; }
  
          /// &lt;summary&gt;
          /// Associated Legal Entity Short Code of the risk
          /// &lt;/summary&gt;
          [Required]
          [Display(Name = &quot;Legal Entity Short Code&quot;)]
          public string LegalEntityShortCode { get; set; }
  }
  </code></pre>
  <p>The following Blazor page:</p>
  <pre><code>    &lt;CustomInputSelect id=&quot;ddlLegalEntity&quot; class=&quot;form-control InputTextHeigth&quot; @bind-Value=&quot;ShowRisk.LegalEntityId&quot;&gt;
              @foreach (var option in LEList)
              {
                  &lt;option value=&quot;@option.Id&quot;&gt;
                   @option.OptionName
                  &lt;/option&gt;
              }
      &lt;/CustomInputSelect&gt;
  &lt;div class=&quot;cs-col-6&quot;&gt;
      &lt;ValidationMessage class=&quot;form-control&quot; For=&quot;@(() =&gt; ShowRisk.LegalEntityId)&quot; /&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Everything is working fine. I can use int value on Option list. However, The validation error is generating as Field name instead of Display name.
  So I getting &quot;The <strong>LegalEntityId</strong> field is Required.&quot; instead of &quot;The <strong>Legal Entity</strong> field is Required&quot;.</p>
  <p>From the first snapshot of the code, the message is generated:</p>
  <pre><code>validationErrorMessage = $&quot;The {FieldIdentifier.FieldName} field is Required.&quot;;
  </code></pre>
  <p>How can I display Model Display name instead of FieldName?</p>