本文介绍了禁用了JavaScript的RequiredFieldValidator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
首先,我已经看到了关于这一议题的其他线程,我只是想要的东西清理了,我被困在。
Firstly I have seen the other threads on this topic and I just want something cleared up that I am stuck on.
我有这样的文本框控件,并要求现场验证:
I have this textbox control and required field validator:
<td class="style1">
<asp:TextBox runat="server" ID="txtFirstname"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvFirstname" runat="server" ControlToValidate="txtFirstname" >*</asp:RequiredFieldValidator>
</td>
和这个JavaScript code
And this javascript code
<script type="text/javascript">
function chkValidators() {
alert("enter function chkValidators");
validatorEnable(document.getElementById('<%rfvFirstname%>'), false);
}
这是给我一个编译错误:
This is giving me a compilation error:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1002: ; expected
Source Error:
Line 158: #line default
Line 159: #line hidden
Line 160: @__w.Write("\'), false);\r\n }\r\n </script>\r\n");
Line 161: }
Line 162:
任何人都知道如何解决这个问题?
Anyone know how to fix this?
尼克
推荐答案
您是否尝试过使用..
Have you tried using..
ValidatorEnable(document.getElementById('<%= rfvFirstname.ClientID %>'), false);
这篇关于禁用了JavaScript的RequiredFieldValidator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!