本文介绍了验证摘要控件显示消息两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请参阅代码
please see the code
<asp:UpdatePanel ID="updatenewuser" runat="server">
<ContentTemplate>
Email Id<span class="resulttext"> *</span>
<asp:TextBox ID="txtEmail" runat="server" CssClass="inputCtrl"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequtxtEmail" runat="server" ControlToValidate="txtEmail"
ErrorMessage="Required Email" Display="Dynamic" ValidationGroup="Reg"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtEmail"
ErrorMessage="Invalid Email" Display="Dynamic" ValidationGroup="Reg" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
Password<span class="resulttext"> *</span>
<asp:TextBox ID="txtregpw" runat="server" TextMode="Password" CssClass="inputCtrl"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqfvtxtregpass" runat="server" ControlToValidate="txtregpw"
ErrorMessage="Required Password" Display="Dynamic" ValidationGroup="Reg"></asp:RequiredFieldValidator>
Confirm Password<span class="resulttext"> *</span>
<asp:TextBox ID="txtregConfpw" runat="server" TextMode="Password" CssClass="inputCtrl"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqfvtxtregConfpw" runat="server" ControlToValidate="txtregConfpw"
ErrorMessage="Required Confirm Password" Display="Dynamic" ValidationGroup="Reg"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="compvaltxtregConfpw" runat="server" ControlToCompare="txtregpw"
ControlToValidate="txtregConfpw" Operator="Equal" ErrorMessage="Miss Match" Display="Dynamic"> </asp:CompareValidator>
<asp:ValidationSummary ID="valsum" runat="server" ValidationGroup="Reg" ShowMessageBox="true"
ShowSummary="false" />
<asp:Button ID="btnbook" runat="server" Text="Book" ValidationGroup="Reg" CausesValidation="true"
OnClick="btnbook_Click" />
<asp:Button ID="btnAddShopingCart" runat="server" ValidationGroup="Reg" CausesValidation="true"
Text="Add To Cart" OnClick="btnAddShopingCart_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnbook" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnAddShopingCart" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
谢谢,
murty。
thanks,
murty.
推荐答案
<asp:ValidationSummary ID="valsum" runat="server" ValidationGroup="Reg" ShowMessageBox="true"
ShowSummary="true" />
<asp:UpdatePanel ID="updatenewuser" runat="server">
<ContentTemplate>
Email Id<span class="resulttext"> *</span>
<asp:TextBox ID="txtEmail" runat="server" CssClass="inputCtrl"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequtxtEmail" runat="server" ControlToValidate="txtEmail"
ErrorMessage="Required Email" Display="Dynamic" ValidationGroup="Reg" Text="*"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtEmail"
ErrorMessage="Invalid Email" Display="Dynamic" ValidationGroup="Reg" Text="*" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
Password<span class="resulttext"> *</span>
<asp:TextBox ID="txtregpw" runat="server" TextMode="Password" CssClass="inputCtrl"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqfvtxtregpass" runat="server" ControlToValidate="txtregpw"
ErrorMessage="Required Password" Display="Dynamic" Text="*" ValidationGroup="Reg"></asp:RequiredFieldValidator>
Confirm Password<span class="resulttext"> *</span>
<asp:TextBox ID="txtregConfpw" runat="server" TextMode="Password" CssClass="inputCtrl"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqfvtxtregConfpw" Text="*" runat="server" ControlToValidate="txtregConfpw"
ErrorMessage="Required Confirm Password" Display="Dynamic" ValidationGroup="Reg"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="compvaltxtregConfpw" Text="*" runat="server" ControlToCompare="txtregpw"
ControlToValidate="txtregConfpw" ValidationGroup="Reg" Operator="Equal" ErrorMessage="Miss Match" Display="Dynamic"> </asp:CompareValidator>
<asp:ValidationSummary ID="valsum" runat="server" ValidationGroup="Reg" ShowMessageBox="true"
ShowSummary="false" />
<asp:Button ID="btnbook" runat="server" Text="Book" ValidationGroup="Reg" CausesValidation="true"
OnClick="btnbook_Click" />
<asp:Button ID="btnAddShopingCart" runat="server" ValidationGroup="Reg" CausesValidation="true"
Text="Add To Cart" OnClick="btnAddShopingCart_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnbook" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnAddShopingCart" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:RequiredFieldValidator ID="reqfvtxtregConfpw" runat="server" ControlToValidate="txtregConfpw"
ErrorMessage="Required Confirm Password" Display="Dynamic" ValidationGroup="Reg" Text="*"></asp:RequiredFieldValidator>
这篇关于验证摘要控件显示消息两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!