验证摘要自动更新

验证摘要自动更新

本文介绍了验证摘要自动更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net应用程序,我试图使用验证摘要在我的web page.I've控制像

In my asp.net application, I've tried to use validation summary in my web page.I've controls like

<td>First Name *</td>
<td>
    <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
    <div>
        <asp:RequiredFieldValidator ID="reqValStaffFirstName" runat="server"
                 ErrorMessage="Enter FirstName" Text="*"
                 ControlToValidate="txtFirstName" Display="Dynamic"
                 ValidationGroup="valGrpStaffGeneral">
         </asp:RequiredFieldValidator>
    </div>
</td>
<td>Last Name *</td>
<td>
    <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>
    <div>
        <asp:RequiredFieldValidator ID="reqValStaffLastName" runat="server"
                 ErrorMessage="Enter LastName" Text="*"
                 ControlToValidate="txtLastName" Display="Dynamic"
                 ValidationGroup="valGrpStaffGeneral">
         </asp:RequiredFieldValidator>
    </div>
</td>
<td>
     <asp:Button Id="btnSave" runat="server" ValidationGroup="valGrpStaffGeneral">
<td>

和我的ValidationSummary脚本

and my validationsummary script is

<asp:ValidationSummary ID="summary1" ShowSummary="true" runat="server"
         ValidationGroup="valGrpStaffGeneral" DisplayMode="BulletList" />

如果我点击保存按钮,而不在TextBox1中填充任何1和TextBox它显示我的验证摘要区域验证错误。如果我填什么在我的文本框和preSS选项卡中的错误(*)自动消失,但在验证摘要错误不会自动改变其显示,直到我点击保存按钮,我应该怎么做才能让验证摘要自动改变固定的错误。

If I click on save button without filling anything in textbox1 and textbox2 its showing validation errors in my validation summary area. If I fill anything in my textboxes and press tab the error(*) disappears automatically, but the error in the validation summary not changing automatically and its displaying until I click on save button, what should I do to make the validation summary change the fixed errors automatically.

推荐答案

这可能会有帮助 - 看的 EnableClientScript 属性的ValidationSummary 控制。

This might be of help - look at the EnableClientScript property of the ValidationSummary control.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.validationsummary.enableclientscript.aspx

这篇关于验证摘要自动更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 22:04