title: Get ControlToValidate Property From CustomValidator in Code Behind
body: <p>I want to get the ControlToValidate Property From Code Behind, here is my aspx.</p>
  
  <pre><code>&lt;asp:CustomValidator runat="server" ID="custtxtTest" OnServerValidate="custtxtTest_ServerValidate" ControlToValidate="txtTest" ForeColor="Red" Text="*" /&gt;
  </code></pre>
  
  <p>In my Code behind I want to get the property "ControlToValidate", but this doesn't seem to be a valid property of source:</p>
  
  <pre><code> protected void custtxtTest_ServerValidate(object source, ServerValidateEventArgs args)
      {
      string test = source.ControlToValidate;
      }
  </code></pre>
  
  <p>I checked <a href="https://stackoverflow.com/questions/3636228/asp-net-custom-validator-how-to-get-the-controltovalidate-property-on-clientv">Asp.Net custom validator: how to get the 'controlToValidate' property on ClientValidationFunction?</a> but that is only for a client function, not in code behind.</p>