asp.net中的自定义验证器

编程入门 行业动态 更新时间:2024-10-21 09:25:19
本文介绍了asp中的自定义验证器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

hi ,, 如果我想使用自定义验证器比较两个文本框,我确切不知道的代码是什么,请尽快告诉我代码 例如,我在一个文本框中输入密码,而另一个是重新输入密码,我想对两个文本框都进行比较,请告诉我代码.......... 在此先感谢..........

hi ,, if i want to compare two textboxes by using custom validator,what is the code i dont know exactly please tell me the code as soon as possible for example am taking password in one textbox and other is retype password,i want comapre both the textboxes please tell me code.......... Thanks In Advance..........

推荐答案

为什么不使用CompareValidator?

<table border="0" bgcolor="#b0c4de"> <tr valign="top"> <td colspan="4"><h4>Compare two values</h4></td> </tr> <tr valign="top"> <td><asp:TextBox id="txt1" runat="server" /></td> <td> = </td> <td><asp:TextBox id="txt2" runat="server" /></td> <td><asp:Button Text="Validate" runat="server" /></td> </tr> </table> <br /> <asp:CompareValidator id="compval" Display="dynamic" ControlToValidate="txt1" ControlToCompare="txt2" ForeColor="red" BackColor="yellow" Type="String" EnableClientScript="false" Text="Validation Failed!" runat="server" />

您可以使用比较验证器,并将controltocompare设置为密码文本框的ID,将controltovalidate设置为确认密码文本框的ID.运算符应相等或类似. you can use compare validator and set the controltocompare as the id of the password textbox and controltovalidate as the id of the confirm password textbox. operator should be equal or something similar.

更多推荐

asp.net中的自定义验证器

本文发布于:2023-11-11 07:09:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577730.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   asp   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!