Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何在调用Click事件之前检查.Net验证是否为True_Jquery_Validation - Fatal编程技术网

Jquery 如何在调用Click事件之前检查.Net验证是否为True

Jquery 如何在调用Click事件之前检查.Net验证是否为True,jquery,validation,Jquery,Validation,我正在使用.Net验证来验证我的表单。问题是,当我单击Submit时,它不会检查表单是否经过验证。即使字段为空,也会触发警报。我希望只有在表单经过验证后才会触发警报。多谢各位 <asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="error-box" /> <asp:Label ID="empLast4Lbl" runat="server" Text="Last 4 digits of

我正在使用.Net验证来验证我的表单。问题是,当我单击Submit时,它不会检查表单是否经过验证。即使字段为空,也会触发警报。我希望只有在表单经过验证后才会触发警报。多谢各位

<asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="error-box" />

<asp:Label ID="empLast4Lbl" runat="server" Text="Last 4 digits of SSN#">Last 4 digits of SSN</asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="empLast4Txt"
                    ErrorMessage="Last 4 digits of SSN is required." ForeColor="Red" CssClass="float-none">*</asp:RequiredFieldValidator>
<asp:TextBox ID="empLast4Txt" runat="server"></asp:TextBox>

<asp:Label ID="empDobLbl" runat="server" Text="Label">Date of Birth</asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="empDobTxt"
                    ErrorMessage="Date of Birth is required." ForeColor="Red" CssClass="float-none">*</asp:RequiredFieldValidator>
<asp:TextBox ID="empDobTxt" runat="server"></asp:TextBox>

<asp:Button ID="submitEmp" runat="server" Text="Submit" Class="ap-webmethod" />

它是通过在ASP.NET母版页中使用jQuery验证来实现的。请参阅此链接

$(".ap-webmethod").click(function () {

                alert("Fired");

        });