title: Adding Validation to Prevent String Input
body: <p>I want to prevent a user from entering a <code>TimeZoneId</code> of type <code>string</code>. Currently, the validation is not catching this issue. How can I prevent a user from entering a string value?  </p>
  
  <p><strong>Validator in my Provider:</strong></p>
  
  <p><em>Currently, my <code>AddValidator</code> prevents a user from entering a null value</em></p>
  
  <pre><code>  AddValidator(p =&gt; p.TimeZoneID != null &amp;&amp; projectValidator.IsTimeZoneIdInvalid(p.TimeZoneID.Value), "TimeZoneId", "Invalid time zone ID");
  </code></pre>
  
  <p><strong>I've tried adding the following, but it doesn't work. It returns an error stating Cannot apply operator '!=' to operands of type 'System.Nullable':</strong></p>
  
  <pre><code>    AddValidator(p =&gt; p.TimeZoneID != null &amp;&amp; p.TimeZoneID != typeof(string) &amp;&amp; projectValidator.IsTimeZoneIdInvalid(p.TimeZoneID.Value), "TimeZoneId", "Invalid time zone ID");
  </code></pre>