title: ASP.Net regular expression validator setting ValidationExpression dynamically
body: <p>I am trying to do this:</p>
  
  <pre><code>&lt;obout:OboutTextBox ID="txtDistributorEmail" runat="server" Width="250" /&gt;
      &lt;asp:RegularExpressionValidator ID="revDistributorEmail" runat="server"     
      ErrorMessage="An invalid email address was entered."                                 
      ValidationExpression='&lt;%=Mynamespace.RegEx.EMAIL %&gt;' 
      ControlToValidate="txtDistributorEmail" /&gt;
  </code></pre>
  
  <p>
  
  <pre><code>namespace Mynamespace
  {
      public class RegEx
      {
          public const string EMAIL = @"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z] 
          [-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$";
      }
   }
  </code></pre>
  
  <p>The validation is failing even when a correct email is entered. But if I replace the <code>ValidationExpression</code> with the regular expression <code>[]</code>, it works fine.</p>
  
  <p>Is there anything in-correct?</p>