Question

I am creating a register form and when the user clicks on the confirm password field, the page refreshes and I lose the text 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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top