title: Dynamic error message for custom validator clientside
body: <p>I am using a custom validator to call a javascript function for validation.  My problem is that I need to be able to change the error message dynamically.  Here is the code:</p>
  
  <pre><code>            &lt;asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="fcnValid1"
                  ErrorMessage=""  Display="None" ValidateEmptyText="True"&gt;
              &lt;/asp:CustomValidator&gt;
  
  &lt;asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" /&gt;
  
      function fcnValid(source, args) {
          var Status = document.getElementById("&lt;%=ddlStatus.ClientID%&gt;").value
  
          if (Status == "In Underwriting") {
              if (document.getElementById("&lt;%=txtRequestor.ClientID%&gt;").value == "") {
                  //sender.errormessage = "Test1"
                  //sender.innerHTML = "Test2";
                  document.getElementById("&lt;%=txtRequestor.ClientID%&gt;").focus();
                  args.IsValid = false;
              }
          }
      }
  </code></pre>