ChangePassword control, Text required error message does not appear
I have a ChangePassword control on a page like thus:
<asp:ChangePassword ID="ChangePassword1" runat="server"
NewPasswordRegularExpressionErrorMessage="Password must be atleast 8 characters, containing upper & lowercase, numeric and special characters."
ConfirmPasswordRequiredErrorMessage="Confirm Password is Required."
PasswordLabelText="Current Password:" OnChangedPassword="ChangePassword1_ChangedPassword">
</asp:ChangePassword>
When the page runs if the user leaves the Confirm Password textbox blank, then the page displays a red * next to the textbox but no error message. Same thing happens for the other textboxes.
H开发者_Go百科owever if the user doesn't meet the Regular Expression rule then the error message set at NewPasswordRegularExpressionErrorMessage is displayed (I'm setting the regex value in the code behind).
I've tried adding a ValidationSummary and pointing it at ChangePassword1 control but no change.
How do I get an error message to display if the user leaves textboxes empty?
I think it will be more worth while in converting that ChangePassword control to a template. This can be done by viewing your page in Design view and selecting your ChangePassword control and clicking the arrow to view the control settings. Click the "Convert to template" link.
This allow you to view all the HTML and controls used in the ChangePassword control. You can then add your own RegularExpression validator. Plus you will have more flexibility.
Information from another StackOverflow post may also help you: ChangePassword control and setting regular expression for new password
精彩评论