updatepanel和验证器错误 [英] updatepanel and validator error

查看:53
本文介绍了updatepanel和验证器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

i有3texbox,1button用于更改密码(使用asp.net会员更改密码)并在updatepanel中使用RequiredFieldValidator,

第一次填写文本框并单击在按钮,一切都很好,

但是第二次当我填充texbox并点击按钮时,所有texbox都是空的,而且RequiredFieldValidator是火并且填充texbox得到错误



要解决这个问题,我该怎么办?



谢谢

这里是我的代码< br $>


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: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" />

推荐答案

remove the update pannel from web page
remove the update pannel from web page


这篇关于updatepanel和验证器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆