0

I have some input fields, regular expression validators, and custom validators inside an ASP.NET ASCX control. The behavior is a bit odd in that it works the following way:

If a client side validator flags an error message and I tab away from the input field and click submit then the page posts as it should. However, if a client side validator has flagged an error and instead I correct the error and click submit button then the error is cleared but the page is not submitted until I click the submit button a second time.

My question is how do I change this behavior such that I only need to click the submit button once to both clear the error and postback the page? Also, is this "behavior" standard?

Update: This behavior occurs without using the user control. I believe it is specific behavior to the CompareValidator. Nope, same behavior occurs with custom validator. If I don't "tab away" and click the button then I must click it twice to get the postback to occur. The first click just clears the validators.

4

1 回答 1

0

问题是 CustomValidator 的显示类型为动态而不是静态。这篇文章帮助我找到了答案

RequiredFieldValidator 必须点击两次

我会感谢任何解释它为什么会导致这种行为的人。

于 2013-10-16T00:15:28.403 回答