title: Asp:Net Required field turn control back color red for validation groups
body: <p>I have successfully been able to turn the back colour of controls red if validation if a required field triggered. However I can't get it work for controls in groups. </p>
  
  <p>I have this js in each of my pages just before the closing body tag</p>
  
  <pre><code>function WebForm_OnSubmit() {
   if (typeof (ValidatorOnSubmit) == "function" &amp;&amp; ValidatorOnSubmit() ==false) {
    for (var i in Page_Validators) {
      try {
          var control = document.getElementById(Page_Validators[i].controltovalidate);
          if (!Page_Validators[i].isvalid) {
              control.className = "ErrorControl";
  
          } else {
              control.className = "";
          }
      } catch (e) {
          var r = 0;
      }
  }
  return false;
  }
  return true;
  }
  </code></pre>
  
  <p>the following css class for the Error styling.</p>
  
  <pre><code>.ErrorControl
  {
      background-color: #FBE3E4;
      border: solid 1px Red;
  }
  </code></pre>
  
  <p>Here is an example of a control in a validation group</p>
  
  <pre><code>&lt;asp:RequiredFieldValidator runat="server" ID="vldTelephoneNumber" ControlToValidate="txtTelephoneNumber" ValidationGroup="ResellerGroup"&gt;&lt;/asp:RequiredFieldValidator&gt;
  </code></pre>
  
  <p>Any help with this would be appreciated</p>