title: ASP.NET - CustomValidator not working after postback
body: <p>I have a simple case.</p>
  
  <p>A custom validator in page Default.aspx</p>
  
  <pre><code>&lt;asp:UpdatePanel ID="UplTab1" runat="server" &gt;
      &lt;ContentTemplate&gt;   
          &lt;span&gt;
              &lt;asp:TextBox ID="MyTextBox" runat="server" Width="400px"&gt;&lt;/asp:TextBox&gt;
              &lt;asp:CustomValidator Display="Dynamic" ID="MyValidator" runat="server" ErrorMessage="Mon message" ControlToValidate="MyTextBox" OnServerValidate="MyValidator_OnServerValidate" ValidationGroup="MyGroup1"&gt;&lt;/asp:CustomValidator&gt;
          &lt;/span&gt;     
          &lt;span&gt;
              &lt;asp:Button ID="BtnSave" runat="server" Text="Save" ValidationGroup="MyGroup1" OnClick="BtnSave_OnClick"&gt;&lt;/asp:Button&gt;
          &lt;/span&gt;                     
      &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>Default.aspx.cs</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
  }
  
  protected void MyValidator_OnServerValidate(object source, ServerValidateEventArgs args)
  {
      args.IsValid = MyValidationFunction();
  }
  </code></pre>
  
  <p>When I try to validate my textbox control, no problem it works, my function "MyValidator_OnServerValidate" is fired. Then I try to re-submit my form again with same button with a different value in my textbox, but this time my custom validator doesn't work anymore.</p>
  
  <p>My question is why this behavior?</p>
  
  <p>I think it's the postback behavior because if I refresh my page, the custom validator works.</p>