title: Custom validator dynamic message
body: <p>I want custom validator dynamic messages. Custom validator for required field and regular expression. I don't want to use required field validator and regular expression validator it creates more problems for me.
  <strong><em>Here is javascript code</em></strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function CheckMyText(sender, args) {
          var compare = RegExp("^.{1,10}$");
          args.IsValid = compare.test(args.Value)
              return;
      }
  &lt;/script&gt; 
  </code></pre>
  
  <p><strong><em>Here is custom validator and text field code</em></strong></p>
  
  <pre><code>&lt;asp:TextBox ID="summary" runat="server" Width="627px" CssClass="texrbox"&gt;&lt;/asp:TextBox&gt;
  
  &lt;asp:CustomValidator ID="CustomValidator2" runat="server" ClientValidationFunction="CheckMyText" ControlToValidate="summary" ErrorMessage="" Text="*" ValidateEmptyText="true"&gt;&lt;/asp:CustomValidator&gt;
  </code></pre>
  
  <p>It is working fine but I want to show message when regular expression error fired <strong><em>Only 10 characters allowed</em></strong> and for required field I want to show <strong><em>Required Field</em></strong>. How to do it. I want to show bith messages in validation summary.</p>