小弟初学的问题,关于如何做修改密码的问题
如题,小弟想做一个修改密码的问题
旧密码:textbox1 RequiredFieldValidator
新密码:textbox2 RequiredFieldValidator
重复新:textbox3 CompareValidator(比较TextBox2和TextBox3)
问题就是textbox1,需要与数据库中的密码检测是否相等,否则验证信息显示在textbox1后.好像验证控件里没有这样的验证控件可以与变量匹配的?
如果有请说说用哪个并如何用?
如果没有你们是如何做的,因为如果在cs里写代码比较当然是可以,但假如不匹配的话需要中断并提示信息,这样的程序设计思想有点不符合面向对象吧?
------解决方案--------------------当然有..comparevalidator可以和控件的值比较
请参考
<asp:textbox id= "txtPassword1 " Runat= "server " TextMode= "Password "> </asp:textbox> <asp:requiredfieldvalidator id= "RFVPassword1 " Runat= "server " ControlToValidate= "txtPassword1 " ErrorMessage= "您必须提供一个密码 "
Display= "Dynamic "> * </asp:requiredfieldvalidator>
<asp:textbox id= "txtPassword2 " Runat= "server " TextMode= "Password "> </asp:textbox>
<asp:requiredfieldvalidator id= "RFVPassword2 " Runat= "server " ControlToValidate= "txtPassword2 " ErrorMessage= "您必须提供一个确认密码 "
Display= "Dynamic "> * </asp:requiredfieldvalidator>
<asp:comparevalidator id= "CVPassword2 " runat= "server " ControlToValidate= "txtPassword2 " ErrorMessage= "确认密码必须与密码相同 "
Display= "Dynamic " ControlToCompare= "txtPassword1 " Operator= "Equal "> * </asp:comparevalidator>