RadControls for ASP.NET AJAX OnClientPasswordStrengthCalculating is fired when using the password strength check feature and changing the text, before the indicator is updated.
Note |
|---|
The OnClientPasswordStrengthCalculating event is supported by RadTextBox with TextMode set to Password and for TextBoxSettings created with RadInputManager. |
Four properties are exposed through the event arguments:
get_passwordText - gets password entered by the user.
get_strengthScore - gets calculated password strength.
set_strengthScore - sets custom calculated password strength.
set_indicatorText - sets the text that will be used in the indicator element instead of the correspondading one from TextStrengthDescriptions.
CopyASPX
<telerik:RadTextBox runat="server" ID="RadTextBox1" Text="Enter Password" TextMode="Password">
<PasswordStrengthSettings ShowIndicator="true" OnClientPasswordStrengthCalculating="CalculatingStrength" />
</telerik:RadTextBox>
CopyJavaScript
<script type="text/javascript">
function CalculatingStrength(sender, args) {
if (args.get_passwordText() == "Enter Password") {
args.set_indicatorText("Custom text");
args.set_strengthScore(0);
}
else {
var calculatedScore = args.get_strengthScore();
args.set_indicatorText("Score: (" + calculatedScore + "/100)");
}
}
</script>
See Also