title: Getting args of Custom Validator control in ASP.net with Javascript?
body: <p>So i have a  which i'm catching the event of it with the ClientValidationFunction. </p>
  
  <p>The problem i'm having is, i'm doing some process with it and outcome of this process should determine whether the args.IsValid should be true or false. But the results i'm catching are in callback where i can't seem to find a way to acces args.</p>
  
  <p>I've defined a var Args globaly and tried to get the value from there; couldn't get it.</p>
  
  <p>I've tried to send it via userContext; no use (think it only accepts string).</p>
  
  <p>I've tried to get the validator by document.getElementById, and i couldn't find the args property. This one is the one i'm most logical to me but i can't seem to find it.</p>
  
  <p>The javascript code i wrote is as this;</p>
  
  <pre><code>function ValidateUserMail(oSrc, args) {
      var myField = document.getElementById('&lt;%=RegisterUserWizardStep.ContentTemplateContainer.FindControl("Email").ClientID %&gt;');
      PageMethods.IsMailAvailable(myField.value, OnSucceeded); 
  }
  
  //i need to edit args value from this function below.
  function OnSucceeded(result, userContext, methodName) {
      if (methodName == "IsMailAvailable")
          if (!result) {
              var myValidator = document.getElementById('&lt;%=RegisterUserWizardStep.ContentTemplateContainer.FindControl("UniqueEmailRequired").ClientID %&gt;');
              myValidator.args = false; //doesn't work any ideas about the working property?
          }
  }
  </code></pre>
  
  <p>and the code i wrote in aspx for validator is as this;</p>
  
  <pre><code>  &lt;asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email" 
    CssClass="failureNotification" ErrorMessage="E-mail is required." ToolTip="E-mail is required." 
    ValidationGroup="RegisterUserValidationGroup"&gt;*&lt;/asp:RequiredFieldValidator&gt;
  
    &lt;asp:CustomValidator ID="UniqueEmailRequired" runat="server" ControlToValidate="Email"
    CssClass="failureNotification" ErrorMessage="Unique E-mail is required." ToolTip="Unique E-mail is required."
    ValidationGroup="RegisterUserValidationGroup" ClientValidationFunction="ValidateUserMail"&gt;*&lt;/asp:CustomValidator&gt;
  </code></pre>
  
  <p>Thanks a lot!</p>
  
  <hr>
  
  <p>Update; rendered html for uniqueEmailValidator Javascript in browser;</p>
  
  <pre><code>    var MainContent_RegisterUser_CreateUserStepContainer_UniqueEmailRequired = document.all ? document.all["MainContent_RegisterUser_CreateUserStepContainer_UniqueEmailRequired"] : document.getElementById("MainContent_RegisterUser_CreateUserStepContainer_UniqueEmailRequired");
      MainContent_RegisterUser_CreateUserStepContainer_UniqueEmailRequired.controltovalidate = "MainContent_RegisterUser_CreateUserStepContainer_Email";
      MainContent_RegisterUser_CreateUserStepContainer_UniqueEmailRequired.errormessage = "Unique E-mail is required.";
      MainContent_RegisterUser_CreateUserStepContainer_UniqueEmailRequired.validationGroup = "RegisterUserValidationGroup";
      MainContent_RegisterUser_CreateUserStepContainer_UniqueEmailRequired.evaluationfunction = "CustomValidatorEvaluateIsValid";
      MainContent_RegisterUser_CreateUserStepContainer_UniqueEmailRequired.clientvalidationfunction = "ValidateUserMail";
  </code></pre>