This example adds a password strength bar to an asp.net textbox password control.

This goes in the page load event.

 

            this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "password_strength", this.ResolveClientUrl("~/javascript/pwd_strength.js"));

            TextBox pwd = (TextBox) this.CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Password");

            pwd.Attributes.Add("onkeyup", "password_strength(this.value);");