-4
我遇到问题。我必须将一个文本框与另外两个文本框进行比较,如果值匹配,则应显示错误消息。在asp.net中比较三个文本框
我已经尝试过两个比较验证器,但一次只能比较一次验证器,所以得到第一个值只能看到我的代码。
<asp:CompareValidator ForeColor="Red" Font-Size="Small" runat="server"
ID="CompareValidator2" controltovalidate="txtsponsorfatherhusbandname"
controltocompare="txtfatherhusbandname" operator="NotEqual" type="String"
errormessage="Sponsor and applicant father name cannot be same" SetFocusOnError="true">
</asp:CompareValidator>
<asp:CompareValidator ForeColor="Red" Font-Size="Small" runat="server"
ID="cmpfather" controltovalidate="txtsponsorname"
controltocompare="txtfatherhusbandname" operator="NotEqual" type="String"
errormessage="Sponsor and applicant father name cannot be same" SetFocusOnError="true">
</asp:CompareValidator>
我用了从代码的文件,但问题编码它
是它刷新页面,所以如果有任何帮助,将不胜感激。 see the picture i want to check if applicant name is not equal to either Sponsor name and sponsor father husband name and if they are equal then they show a message and focus is on applicant name
这个脚本没有显示语句ID无效 –
后在文本框前面的任何消息,我曾试图 sender.innerHTML =“您与任何来到这里的HTML”; document.getElementById('lbltipAddedComment')。innerHTML ='您的提示已被提交!';但标签的值也不会改变 –
显示CustomValidator的'ErrorMessage'。 – VDWWD