开发者

RequiredFieldValidator keeps refreshing the page

开发者 https://www.devze.com 2023-02-04 21:00 出处:网络
I am creating a register form and when the user clicks on the confirm password field, the page refreshes and I lose the text开发者_如何学C from the other field (the password field)

I am creating a register form and when the user clicks on the confirm password field, the page refreshes and I lose the text开发者_如何学C from the other field (the password field)

The code to the confirm password is here below:

<asp:RequiredFieldValidator ValidationGroup="CreateAccount1" 
    CssClass="FieldValidator" EnableClientScript="true"
    ControlToValidate="TxtPass" ID="pPassword" runat="server"
    Text="Password required" ErrorMessage="Password required" />

Thanks, C.


It looks like the AutoPostBack property of your first password field is set to true. In that case, the page will be posted back to the server as soon as that field loses focus, bypassing client validation.

You might want to set that property to false instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消