比较asp.net中的三个文本框

时间:2017-08-07 13:07:50

标签: c# jquery 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

1 个答案:

答案 0 :(得分:0)

您可以使用let homeTab = UINavigationController(rootViewController:HomePage()) self.viewControllers = [homeTab] 。您可以在CustomValidator

中编写自己的逻辑
ClientValidationFunction