Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello,
i have problem in asp.net membership change password in update panel.
my probelm similar this post:
Required field validator with Update panel[^]

The first when i fill textbox with wrong dada error message was show:

Password incorrect or New Password invalid. New Password length minimum: 7. Non-alphanumeric characters required: 1.

but For the second time i do the same thing again, but RequiredFieldValidator is fire and star was show near in textbox and textbox is refreshed (textbox value deleted).
how i can solve this problem?

ASP.NET
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:ChangePassword ID="ChangePassword1" runat="server">
            <ChangePasswordTemplate>
                <table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
                    <tr>
                        <td>
                            <table cellpadding="0">
                                <tr>
                                    <td align="center" colspan="2">Change Your Password</td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="CurrentPasswordLabel" runat="server" AssociatedControlID="CurrentPassword">Password:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="CurrentPassword" runat="server" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="NewPasswordLabel" runat="server" AssociatedControlID="NewPassword">New Password:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="NewPassword" runat="server" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword" ErrorMessage="New Password is required." ToolTip="New Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="ConfirmNewPasswordLabel" runat="server" AssociatedControlID="ConfirmNewPassword">Confirm New Password:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="ConfirmNewPassword" runat="server" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword" ErrorMessage="Confirm New Password is required." ToolTip="Confirm New Password is required." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2">
                                        <asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword" Display="Dynamic" ErrorMessage="The Confirm New Password must match the New Password entry." ValidationGroup="ChangePassword1"></asp:CompareValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2" style="color:Red;">
                                        <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:LinkButton ID="ChangePasswordPushButton" runat="server"  CommandName="ChangePassword" Text="Change Password" ValidationGroup="ChangePassword1" />
                                    </td>
                                    <td>
                                        <asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ChangePasswordTemplate>
        </asp:ChangePassword>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
    <ProgressTemplate>
        <img src="../Static/Css/Images/loading.gif" />now connecting to the server ...
    </ProgressTemplate>
</asp:UpdateProgress>
Posted

1 solution

In my experience, UpdatePanel leads to a lot of problems which are very hard to debug and fix, can you do this job without using one? Another consideration is, does it happen on all the browsers?
 
Share this answer
 
v2
Comments
SadeqHatami 4-Sep-13 3:28am    
in IE,FF,Chrome i get this error
i want do this senario,i want dont refresh my page, do you know another seanario for this?
anuradha.sardesai 4-Sep-13 3:37am    
A while ago, a replaced my updatePanels with AJAX calls thru JQuery or JavaScript; that eliminates the need for full page refresh and makes XML-Http call.

Please refer to http://api.jquery.com/jQuery.ajax/ for Ajax call thru Jquery.

refer to http://www.w3schools.com/ajax/ajax_xmlhttprequest_create.asp for Javascript call.
SadeqHatami 4-Sep-13 4:00am    
thank's for your help, can you show me how i can put <asp:changepassword> in to xmlhttprequest?
anuradha.sardesai 4-Sep-13 4:39am    
You also have to worry about security. Your best bet could be opening just the change password in a totally different page, open that page in iframe, or open a modal window. I'm sorry, I can't really help you with code and all, as I've to log off now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900