Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hello
i have 3texbox,1button for change password (use asp.net membership change password) and use RequiredFieldValidator in updatepanel,
The first when i fill textboxs and click in the button, allthing is good,
but for the second time when i fill texbox and click in the button all texbox is empty and RequiredFieldValidator is fire and get error for fill texbox

To solve this problem, what should I do?

thank's
here is my code

ASP.NET
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdateProgress ID="updProgress" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
        <ProgressTemplate>
            <img src="../Static/Css/Images/loading.gif" />
            now connecting to the server ...
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger runat="server" ControlID="ChangePasswordPushButton" />
        </Triggers>
        <ContentTemplate>
            <asp:ChangePassword ID="ChangePassword1" runat="server" ChangePasswordButtonText="change your password" CancelButtonText="cancel" ChangePasswordTitleText="change your password" ConfirmNewPasswordLabelText="conferm your password" ConfirmPasswordCompareErrorMessage="the new password same must be the conferm password." ConfirmPasswordRequiredErrorMessage="please enter your conferm password." NewPasswordLabelText="new password:" NewPasswordRegularExpressionErrorMessage="the new password in not accept.please change your password" NewPasswordRequiredErrorMessage="type the new password." PasswordLabelText="last password:" PasswordRequiredErrorMessage="type new password." SuccessText="your password changed successfuly." UserNameLabelText="user name:" UserNameRequiredErrorMessage="please type your user name." ChangePasswordFailureText="the last password or the new passwor is not corrent.password must be {0} character and {1}. ">
                <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">last password:</asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="CurrentPassword" runat="server" TextMode="Password"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword" ErrorMessage="please enter password." ToolTip="please enter password." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="ConfirmNewPasswordLabel" runat="server" AssociatedControlID="ConfirmNewPassword">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="please enter new password" ToolTip="please enter new password" ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="NewPasswordLabel" runat="server" AssociatedControlID="NewPassword">conferm the passwordد:</asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="ConfirmNewPassword" runat="server" TextMode="Password"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword" ErrorMessage="please enter confirm new password" ToolTip="please enter confirm new password." ValidationGroup="ChangePassword1">*</asp:RequiredFieldValidator>
                                        </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="center" colspan="2">
                                            <asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword" Display="Dynamic" ErrorMessage="t" ValidationGroup="ChangePassword1"></asp:CompareValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="ChangePassword1" DisplayMode="List" />
                                        </td>
                            </td>
                            <td>
                                <asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="cancle" UseSubmitBehavior="False" ValidationGroup="ChangePassword1" />
                            </td>
                        </tr>
                        <td>
                        </tr>
                    </table>
                    </td>
                                                    </tr>
                                                </table>
                </ChangePasswordTemplate>
                <SuccessTextStyle ForeColor="#66FF33" />
            </asp:ChangePassword>
        </ContentTemplate>
    </asp:UpdatePanel>
            <asp:Button ID="ChangePasswordPushButton" runat="server" CommandName="ChangePassword" Text="change your password" UseSubmitBehavior="False" ValidationGroup="ChangePassword1" />
Posted
Updated 1-Sep-13 2:36am
v2
Comments
Nelek 1-Sep-13 7:54am    
For a start, you could use the "improve question" widget and add a piece of relevant code where the error is being triggered. With that information is difficult to know what happens. Please read What have you tried?[^] to understand what I mean

1 solution

remove the update pannel from web page
 
Share this answer
 
Comments
SadeqHatami 1-Sep-13 14:13pm    
i want the page don't postbak and refresh,when i remove this page will be refreshed

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