title: Should I trust ASP.NET DataTypeCheck validation?
body: <p>I'm using ASP.NET CompareValidator controls to do data type checks. Should I trust these controls enough to directly parse their values or should I use TryParse?</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;asp:TextBox ID="uxVolume" runat="server" /&gt;
  &lt;asp:CompareValidator ID="uxVolumeDataTypeValidator" runat="server" 
      ControlToValidate="uxVolume" ErrorMessage="Volume must be a number." 
      Type="Double" Operator="DataTypeCheck" Text="*" Display="Dynamic" /&gt;
  </code></pre>
  
  <p>in the code behind page should I Parse:</p>
  
  <pre><code>var volume = double.Parse(uxVolume.Text);
  // do something
  </code></pre>
  
  <p>or TryParse:</p>
  
  <pre><code>double volume;
  if (double.TryParse(uxVolume.Text, out volume))
  {
      // do something
  }
  </code></pre>