本文介绍了必填现场验证员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下必填字段验证器无效。
请解决。
谢谢
Following required field validator is not working.
Please resolve.
Thanks
<pre lang="HTML">
<asp:TextBox ID="txtOECCSecurityCode" runat="server" CssClass="textbox3" Width="350"></asp:TextBox>
<asp:RequiredFieldValidator ID="refOECCSecurityCode" runat="server" ControlToValidate="txtOECCSecurityCode" Display="Dynamic" ErrorMessage="" Font-Size="11px" ForeColor="Red" ValidationGroup="vgOE">Security Code required</asp:RequiredFieldValidator>
按钮代码如下
button code as follow
<asp:Button ID="btnEPSubmit" runat="server" Text="Submit" CssClass="button" OnClick="btnEPSubmit_Click"
OnClientClick="return showContent()" ValidationGroup="vgEP" style="height: 26px" />
推荐答案
This validation does not work, because on button click you are firing onclientclick event. which overrides RequiredFieldValidator. Also, RequiredFieldValidator having ValidationGroup="vgOE" and Button having ValidationGroup="vgEP". This both validationgroup should be same.
希望它有所帮助。
谢谢。
Hope it helps.
Thanks.
这篇关于必填现场验证员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!