private void WriteContinuePanel(HtmlTextWriter writer, ChangePassword changePwd) { WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-ContinuePanel", ""); string id = "Continue"; id += (changePwd.ChangePasswordButtonType == ButtonType.Button) ? "Push" : ""; string idWithType = WebControlAdapterExtender.MakeIdWithButtonType(id, changePwd.ContinueButtonType); Control btn = changePwd.SuccessTemplateContainer.FindControl(idWithType); if (btn != null) { Page.ClientScript.RegisterForEventValidation(btn.UniqueID); Extender.WriteSubmit(writer, changePwd.ContinueButtonType, changePwd.ContinueButtonStyle.CssClass, changePwd.SuccessTemplateContainer.ID + "_" + id, changePwd.ContinueButtonImageUrl, "", changePwd.ContinueButtonText); } WebControlAdapterExtender.WriteEndDiv(writer); }
public SuccessContainer (ChangePassword owner) : base (owner) { ID = "SuccessContainerID"; }
private void AddChangePasswordControl() { TemplateHelper helper; string provider = Utils.GetMembershipProvider(Context); //Exit if membership provider not defined if (provider == null || !Utils.IsProviderConfigured()) { Controls.Add(new LiteralControl(LocalizedString.GetString("FBAPackFeatures", "MembershipNotConfigured"))); return; } if (SPContext.Current.Web.CurrentUser == null) { //Login Control won't work with SP2010, so for now, just don't show a control at all //Login ctlLogin = new Login(); //this.Controls.Add(ctlLogin); } else { _ctlChangePassword = new System.Web.UI.WebControls.ChangePassword(); _ctlChangePassword.ChangePasswordTemplate = new TemplateLoader(ChangePasswordTemplate, Page); _ctlChangePassword.SuccessTemplate = new TemplateLoader(SuccessTemplate, Page); _ctlChangePassword.MembershipProvider = provider; _ctlChangePassword.ChangePasswordFailureText = ChangePasswordFailureText; if (!String.IsNullOrEmpty(CancelDestinationPageUrl)) { _ctlChangePassword.CancelDestinationPageUrl = CancelDestinationPageUrl; } else { string url = SPUtility.OriginalServerRelativeRequestUrl; SPUtility.DetermineRedirectUrl(url, SPRedirectFlags.UseSource, this.Context, null, out url); _ctlChangePassword.CancelDestinationPageUrl = url; } if (!String.IsNullOrEmpty(ContinueDestinationPageUrl)) { _ctlChangePassword.ContinueDestinationPageUrl = ContinueDestinationPageUrl; } else { string url = SPUtility.OriginalServerRelativeRequestUrl; SPUtility.DetermineRedirectUrl(url, SPRedirectFlags.UseSource, this.Context, null, out url); _ctlChangePassword.ContinueDestinationPageUrl = url; } _ctlChangePassword.ToolTip = ToolTip; _ctlChangePassword.SuccessPageUrl = SuccessPageUrl; _ctlChangePassword.NewPasswordRegularExpressionErrorMessage = NewPasswordRegularExpressionErrorMessage; //ChangePasswordTemplate //have to initially force DisplayUserName true to access template _ctlChangePassword.DisplayUserName = true; helper = new TemplateHelper(_ctlChangePassword.ChangePasswordTemplateContainer); _ctlChangePassword.DisplayUserName = DisplayUserName; helper.SetText("ChangePasswordTitle", ChangePasswordTitleText); helper.SetText("Instruction", InstructionText); helper.SetVisible("UserNameRow", DisplayUserName); helper.SetText("UserNameLabel", UserNameLabelText); helper.SetValidation("UserNameRequired", UserNameRequiredErrorMessage, this.UniqueID); helper.SetText("CurrentPasswordLabel", PasswordLabelText); helper.SetValidation("CurrentPasswordRequired", PasswordRequiredErrorMessage, this.UniqueID); helper.SetText("NewPasswordLabel", NewPasswordLabelText); helper.SetValidation("NewPasswordRequired", NewPasswordRequiredErrorMessage, this.UniqueID); helper.SetText("PasswordHint", PasswordHintText); helper.SetVisible("PasswordHintRow", !String.IsNullOrEmpty(PasswordHintText)); helper.SetText("ConfirmNewPasswordLabel", ConfirmNewPasswordLabelText); helper.SetValidation("ConfirmNewPasswordRequired", ConfirmPasswordRequiredErrorMessage, this.UniqueID); helper.SetValidation("ConfirmNewPasswordCompare", ConfirmPasswordCompareErrorMessage, this.UniqueID); switch (ChangePasswordButtonType) { case ButtonType.Button: helper.SetButton("ChangePasswordButton", ChangePasswordButtonText, this.UniqueID); helper.SetVisible("ChangePasswordButton", true); break; case ButtonType.Image: helper.SetImageButton("ChangePasswordImageButton", ChangePasswordButtonImageUrl, ChangePasswordButtonText, this.UniqueID); helper.SetVisible("ChangePasswordImageButton", true); break; case ButtonType.Link: helper.SetButton("ChangePasswordLinkButton", ChangePasswordButtonText, this.UniqueID); helper.SetVisible("ChangePasswordLinkButton", true); break; } switch (CancelButtonType) { case ButtonType.Button: helper.SetButton("CancelButton", CancelButtonText, this.UniqueID); helper.SetVisible("CancelButton", true); break; case ButtonType.Image: helper.SetImageButton("CancelImageButton", CancelButtonImageUrl, CancelButtonText, this.UniqueID); helper.SetVisible("CancelImageButton", true); break; case ButtonType.Link: helper.SetButton("CancelLinkButton", CancelButtonText, this.UniqueID); helper.SetVisible("CancelLinkButton", true); break; } helper.SetVisible("EditProfileRow", !String.IsNullOrEmpty(EditProfileUrl)); helper.SetImage("EditProfileIcon", EditProfileIconUrl, EditProfileText,false); helper.SetLink("EditProfileLink", EditProfileText, EditProfileUrl); helper.SetVisible("HelpPageRow", !String.IsNullOrEmpty(HelpPageUrl)); helper.SetImage("HelpPageIcon", HelpPageIconUrl, HelpPageText, false); helper.SetLink("HelpPageLink", HelpPageText, HelpPageUrl); helper.SetVisible("CreateUserRow", !String.IsNullOrEmpty(CreateUserUrl)); helper.SetImage("CreateUserIcon", CreateUserIconUrl, CreateUserText, false); helper.SetLink("CreateUserLink", CreateUserText, CreateUserUrl); helper.SetVisible("PasswordRecoveryRow", !String.IsNullOrEmpty(PasswordRecoveryUrl)); helper.SetImage("PasswordRecoveryIcon", PasswordRecoveryIconUrl, PasswordRecoveryText, false); helper.SetLink("PasswordRecoveryLink", PasswordRecoveryText, PasswordRecoveryUrl); //SuccessTemplate helper = new TemplateHelper(_ctlChangePassword.SuccessTemplateContainer); helper.SetText("Success", SuccessText); helper.SetVisible("EditProfileRow", !String.IsNullOrEmpty(EditProfileUrl)); helper.SetImage("EditProfileIcon", EditProfileIconUrl, EditProfileText, false); helper.SetLink("EditProfileLink", EditProfileText, EditProfileUrl); switch (ContinueButtonType) { case ButtonType.Button: helper.SetButton("ContinueButton", ContinueButtonText, this.UniqueID); helper.SetVisible("ContinueButton", true); break; case ButtonType.Image: helper.SetImageButton("ContinueImageButton", ContinueButtonImageUrl, ContinueButtonText, this.UniqueID); helper.SetVisible("ContinueImageButton", true); break; case ButtonType.Link: helper.SetButton("ContinueLinkButton", ContinueButtonText, this.UniqueID); helper.SetVisible("ContinueLinkButton", true); break; } //_ctlChangePassword.ChangingPassword += new LoginCancelEventHandler(ctlChangePassword_ChangingPassword); _ctlChangePassword.ChangedPassword += new EventHandler(_ctlChangePassword_ChangedPassword); _ctlChangePassword.Load += new EventHandler(_ctlChangePassword_Load); this.Controls.Add(_ctlChangePassword); } }
/// <summary> /// Writes the success title panel. /// </summary> /// <param name="writer"> /// The writer. /// </param> /// <param name="changePwd"> /// The change PWD. /// </param> /// <remarks> /// </remarks> private static void WriteSuccessTitlePanel(HtmlTextWriter writer, ChangePassword changePwd) { if (String.IsNullOrEmpty(changePwd.SuccessTitleText)) { return; } var className = (!String.IsNullOrEmpty(changePwd.TitleTextStyle.CssClass)) ? changePwd.TitleTextStyle.CssClass + " " : string.Empty; className += "AspNet-ChangePassword-SuccessTitlePanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, string.Empty); WebControlAdapterExtender.WriteSpan(writer, string.Empty, changePwd.SuccessTitleText); WebControlAdapterExtender.WriteEndDiv(writer); }
internal SuccessDefaultTemplate (ChangePassword cPassword) { _cPassword = cPassword; }
private void WritePasswordRecoveryPanel(HtmlTextWriter writer, ChangePassword changePwd) { if ((!String.IsNullOrEmpty(changePwd.PasswordRecoveryUrl)) || (!String.IsNullOrEmpty(changePwd.PasswordRecoveryText))) { WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-PasswordRecoveryPanel", ""); WebControlAdapterExtender.WriteImage(writer, changePwd.PasswordRecoveryIconUrl, "Password recovery"); WebControlAdapterExtender.WriteLink(writer, changePwd.HyperLinkStyle.CssClass, changePwd.PasswordRecoveryUrl, "Password recovery", changePwd.PasswordRecoveryText); WebControlAdapterExtender.WriteEndDiv(writer); } }
///////////////////////////////////////////////////////// // Step 2: success ///////////////////////////////////////////////////////// private void WriteSuccessTitlePanel(HtmlTextWriter writer, ChangePassword changePwd) { if (!String.IsNullOrEmpty(changePwd.SuccessTitleText)) { string className = (changePwd.TitleTextStyle != null) && (!String.IsNullOrEmpty(changePwd.TitleTextStyle.CssClass)) ? changePwd.TitleTextStyle.CssClass + " " : ""; className += "AspNet-ChangePassword-SuccessTitlePanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, ""); WebControlAdapterExtender.WriteSpan(writer, "", changePwd.SuccessTitleText); WebControlAdapterExtender.WriteEndDiv(writer); } }
private void WriteHelpPanel(HtmlTextWriter writer, ChangePassword changePwd) { if ((!String.IsNullOrEmpty(changePwd.HelpPageIconUrl)) || (!String.IsNullOrEmpty(changePwd.HelpPageText))) { WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-HelpPanel"); WebControlAdapterExtender.WriteImage(writer, changePwd.HelpPageIconUrl, "Help"); WebControlAdapterExtender.WriteLink(writer, changePwd.HyperLinkStyle.CssClass, changePwd.HelpPageUrl, "Help", changePwd.HelpPageText); WebControlAdapterExtender.WriteEndDiv(writer); } }
private void AddChangePasswordControl() { TemplateHelper helper; string provider = Utils.GetMembershipProvider(Context); //Exit if membership provider not defined if (provider == null || !Utils.IsProviderConfigured()) { Controls.Add(new LiteralControl(LocalizedString.GetString("FBAPackFeatures", "MembershipNotConfigured"))); return; } if (SPContext.Current.Web.CurrentUser == null) { //Login Control won't work with SP2010, so for now, just don't show a control at all //Login ctlLogin = new Login(); //this.Controls.Add(ctlLogin); } else { _ctlChangePassword = new System.Web.UI.WebControls.ChangePassword(); _ctlChangePassword.ChangePasswordTemplate = new TemplateLoader(ChangePasswordTemplate, Page); _ctlChangePassword.SuccessTemplate = new TemplateLoader(SuccessTemplate, Page); _ctlChangePassword.MembershipProvider = provider; _ctlChangePassword.ChangePasswordFailureText = ChangePasswordFailureText; if (!String.IsNullOrEmpty(CancelDestinationPageUrl)) { _ctlChangePassword.CancelDestinationPageUrl = CancelDestinationPageUrl; } else { string url = SPUtility.OriginalServerRelativeRequestUrl; SPUtility.DetermineRedirectUrl(url, SPRedirectFlags.UseSource, this.Context, null, out url); _ctlChangePassword.CancelDestinationPageUrl = url; } if (!String.IsNullOrEmpty(ContinueDestinationPageUrl)) { _ctlChangePassword.ContinueDestinationPageUrl = ContinueDestinationPageUrl; } else { string url = SPUtility.OriginalServerRelativeRequestUrl; SPUtility.DetermineRedirectUrl(url, SPRedirectFlags.UseSource, this.Context, null, out url); _ctlChangePassword.ContinueDestinationPageUrl = url; } _ctlChangePassword.ToolTip = ToolTip; _ctlChangePassword.SuccessPageUrl = SuccessPageUrl; _ctlChangePassword.NewPasswordRegularExpressionErrorMessage = NewPasswordRegularExpressionErrorMessage; //ChangePasswordTemplate //have to initially force DisplayUserName true to access template _ctlChangePassword.DisplayUserName = true; helper = new TemplateHelper(_ctlChangePassword.ChangePasswordTemplateContainer); _ctlChangePassword.DisplayUserName = DisplayUserName; helper.SetText("ChangePasswordTitle", ChangePasswordTitleText); helper.SetText("Instruction", InstructionText); helper.SetVisible("UserNameRow", DisplayUserName); helper.SetText("UserNameLabel", UserNameLabelText); helper.SetValidation("UserNameRequired", UserNameRequiredErrorMessage, this.UniqueID); helper.SetText("CurrentPasswordLabel", PasswordLabelText); helper.SetValidation("CurrentPasswordRequired", PasswordRequiredErrorMessage, this.UniqueID); helper.SetText("NewPasswordLabel", NewPasswordLabelText); helper.SetValidation("NewPasswordRequired", NewPasswordRequiredErrorMessage, this.UniqueID); helper.SetText("PasswordHint", PasswordHintText); helper.SetVisible("PasswordHintRow", !String.IsNullOrEmpty(PasswordHintText)); helper.SetText("ConfirmNewPasswordLabel", ConfirmNewPasswordLabelText); helper.SetValidation("ConfirmNewPasswordRequired", ConfirmPasswordRequiredErrorMessage, this.UniqueID); helper.SetValidation("ConfirmNewPasswordCompare", ConfirmPasswordCompareErrorMessage, this.UniqueID); switch (ChangePasswordButtonType) { case ButtonType.Button: helper.SetButton("ChangePasswordButton", ChangePasswordButtonText, this.UniqueID); helper.SetVisible("ChangePasswordButton", true); break; case ButtonType.Image: helper.SetImageButton("ChangePasswordImageButton", ChangePasswordButtonImageUrl, ChangePasswordButtonText, this.UniqueID); helper.SetVisible("ChangePasswordImageButton", true); break; case ButtonType.Link: helper.SetButton("ChangePasswordLinkButton", ChangePasswordButtonText, this.UniqueID); helper.SetVisible("ChangePasswordLinkButton", true); break; } switch (CancelButtonType) { case ButtonType.Button: helper.SetButton("CancelButton", CancelButtonText, this.UniqueID); helper.SetVisible("CancelButton", true); break; case ButtonType.Image: helper.SetImageButton("CancelImageButton", CancelButtonImageUrl, CancelButtonText, this.UniqueID); helper.SetVisible("CancelImageButton", true); break; case ButtonType.Link: helper.SetButton("CancelLinkButton", CancelButtonText, this.UniqueID); helper.SetVisible("CancelLinkButton", true); break; } helper.SetVisible("EditProfileRow", !String.IsNullOrEmpty(EditProfileUrl)); helper.SetImage("EditProfileIcon", EditProfileIconUrl, EditProfileText, false); helper.SetLink("EditProfileLink", EditProfileText, EditProfileUrl); helper.SetVisible("HelpPageRow", !String.IsNullOrEmpty(HelpPageUrl)); helper.SetImage("HelpPageIcon", HelpPageIconUrl, HelpPageText, false); helper.SetLink("HelpPageLink", HelpPageText, HelpPageUrl); helper.SetVisible("CreateUserRow", !String.IsNullOrEmpty(CreateUserUrl)); helper.SetImage("CreateUserIcon", CreateUserIconUrl, CreateUserText, false); helper.SetLink("CreateUserLink", CreateUserText, CreateUserUrl); helper.SetVisible("PasswordRecoveryRow", !String.IsNullOrEmpty(PasswordRecoveryUrl)); helper.SetImage("PasswordRecoveryIcon", PasswordRecoveryIconUrl, PasswordRecoveryText, false); helper.SetLink("PasswordRecoveryLink", PasswordRecoveryText, PasswordRecoveryUrl); //SuccessTemplate helper = new TemplateHelper(_ctlChangePassword.SuccessTemplateContainer); helper.SetText("Success", SuccessText); helper.SetVisible("EditProfileRow", !String.IsNullOrEmpty(EditProfileUrl)); helper.SetImage("EditProfileIcon", EditProfileIconUrl, EditProfileText, false); helper.SetLink("EditProfileLink", EditProfileText, EditProfileUrl); switch (ContinueButtonType) { case ButtonType.Button: helper.SetButton("ContinueButton", ContinueButtonText, this.UniqueID); helper.SetVisible("ContinueButton", true); break; case ButtonType.Image: helper.SetImageButton("ContinueImageButton", ContinueButtonImageUrl, ContinueButtonText, this.UniqueID); helper.SetVisible("ContinueImageButton", true); break; case ButtonType.Link: helper.SetButton("ContinueLinkButton", ContinueButtonText, this.UniqueID); helper.SetVisible("ContinueLinkButton", true); break; } //_ctlChangePassword.ChangingPassword += new LoginCancelEventHandler(ctlChangePassword_ChangingPassword); _ctlChangePassword.ChangedPassword += new EventHandler(_ctlChangePassword_ChangedPassword); _ctlChangePassword.Load += new EventHandler(_ctlChangePassword_Load); this.Controls.Add(_ctlChangePassword); } }
void TestRenderFailure (ChangePassword cp, string message, bool shouldFail = true) { using (var sw = new StringWriter ()) { using (var w = new HtmlTextWriter (sw)) { if (shouldFail) AssertExtensions.Throws<InvalidOperationException> (() => { cp.RenderControl (w); }, message); else { cp.RenderControl (w); Assert.IsTrue (sw.ToString ().Length > 0, message); } } } }
public static ChangePassword CreateTestControl (Page p) { LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG); LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG); ChangePassword w = new ChangePassword (); w.ID = "ChangePassword1"; w.DisplayUserName = true; w.MembershipProvider = "FakeProvider"; p.Form.Controls.Add (lcb); p.Form.Controls.Add (w); p.Form.Controls.Add (lce); return w; }
public void RenderOuterTableForbiddenStyles () { var cp = new ChangePassword (); cp.RenderOuterTable = false; cp.BackColor = Color.Red; TestRenderFailure (cp, "BackColor"); cp = new ChangePassword (); cp.RenderOuterTable = false; cp.BorderColor = Color.Red; TestRenderFailure (cp, "BorderColor"); cp = new ChangePassword (); cp.RenderOuterTable = false; cp.BorderStyle = BorderStyle.Dashed; TestRenderFailure (cp, "BorderStyle"); cp = new ChangePassword (); cp.RenderOuterTable = false; cp.BorderWidth = new Unit (10, UnitType.Pixel); TestRenderFailure (cp, "BorderWidth"); cp = new ChangePassword (); cp.RenderOuterTable = false; cp.CssClass = "MyClass"; TestRenderFailure (cp, "CssClass"); cp = new ChangePassword (); cp.RenderOuterTable = false; cp.Font.Bold = true; TestRenderFailure (cp, "Font", false); cp = new ChangePassword (); cp.RenderOuterTable = false; cp.ForeColor = Color.Red; TestRenderFailure (cp, "ForeColor"); cp = new ChangePassword (); cp.RenderOuterTable = false; cp.Height = new Unit (20, UnitType.Pixel); TestRenderFailure (cp, "Height"); cp = new ChangePassword (); cp.RenderOuterTable = false; cp.Width = new Unit (20, UnitType.Pixel); TestRenderFailure (cp, "Width"); }
public BaseChangePasswordContainer (ChangePassword owner) { if (owner == null) throw new ArgumentNullException ("owner"); _owner = owner; #if NET_4_0 renderOuterTable = _owner.RenderOuterTable; if (renderOuterTable) #endif InitTable (); }
/// <summary> /// Writes the password panel. /// </summary> /// <param name="writer"> /// The writer. /// </param> /// <param name="changePwd"> /// The change PWD. /// </param> /// <remarks> /// </remarks> private void WritePasswordPanel(HtmlTextWriter writer, ChangePassword changePwd) { var textbox = changePwd.ChangePasswordTemplateContainer.FindControl("CurrentPassword") as TextBox; if (textbox != null) { this.Page.ClientScript.RegisterForEventValidation(textbox.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-PasswordPanel", string.Empty); this.Extender.WriteTextBox( writer, true, changePwd.LabelStyle.CssClass, changePwd.PasswordLabelText, changePwd.TextBoxStyle.CssClass, changePwd.ChangePasswordTemplateContainer.ID + "_CurrentPassword", string.Empty); WebControlAdapterExtender.WriteRequiredFieldValidator( writer, changePwd.ChangePasswordTemplateContainer.FindControl("CurrentPasswordRequired") as RequiredFieldValidator, changePwd.ValidatorTextStyle.CssClass, "CurrentPassword", changePwd.PasswordRequiredErrorMessage); WebControlAdapterExtender.WriteEndDiv(writer); } }
private void WriteCreateUserPanel(HtmlTextWriter writer, ChangePassword changePwd) { if ((!String.IsNullOrEmpty(changePwd.CreateUserUrl)) || (!String.IsNullOrEmpty(changePwd.CreateUserText))) { WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-CreateUserPanel", ""); WebControlAdapterExtender.WriteImage(writer, changePwd.CreateUserIconUrl, "Create user"); WebControlAdapterExtender.WriteLink(writer, changePwd.HyperLinkStyle.CssClass, changePwd.CreateUserUrl, "Create user", changePwd.CreateUserText); WebControlAdapterExtender.WriteEndDiv(writer); } }
public BaseChangePasswordContainer (ChangePassword owner) { _owner = owner; InitTable (); }
private void WriteNewPasswordPanel(HtmlTextWriter writer, ChangePassword changePwd) { TextBox textbox = changePwd.ChangePasswordTemplateContainer.FindControl("NewPassword") as TextBox; if (textbox != null) { Page.ClientScript.RegisterForEventValidation(textbox.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-NewPasswordPanel", ""); Extender.WriteTextBox(writer, true, changePwd.LabelStyle.CssClass, changePwd.NewPasswordLabelText, changePwd.TextBoxStyle.CssClass, changePwd.ChangePasswordTemplateContainer.ID + "_NewPassword", ""); WebControlAdapterExtender.WriteRequiredFieldValidator(writer, changePwd.ChangePasswordTemplateContainer.FindControl("NewPasswordRequired") as RequiredFieldValidator, changePwd.ValidatorTextStyle.CssClass, "NewPassword", changePwd.NewPasswordRequiredErrorMessage); WebControlAdapterExtender.WriteRegularExpressionValidator(writer, changePwd.ChangePasswordTemplateContainer.FindControl("RegExpValidator") as RegularExpressionValidator, changePwd.ValidatorTextStyle.CssClass, "NewPassword", changePwd.NewPasswordRegularExpressionErrorMessage, changePwd.NewPasswordRegularExpression); WebControlAdapterExtender.WriteEndDiv(writer); } }
public ChangePasswordContainer (ChangePassword owner) : base (owner) { ID = "ChangePasswordContainerID"; }
private void WriteSubmitPanel(HtmlTextWriter writer, ChangePassword changePwd) { WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-SubmitPanel", ""); string id = "ChangePassword"; id += (changePwd.ChangePasswordButtonType == ButtonType.Button) ? "Push" : ""; string idWithType = WebControlAdapterExtender.MakeIdWithButtonType(id, changePwd.ChangePasswordButtonType); Control btn = changePwd.ChangePasswordTemplateContainer.FindControl(idWithType); if (btn != null) { Page.ClientScript.RegisterForEventValidation(btn.UniqueID); PostBackOptions options = new PostBackOptions(btn, "", "", false, false, false, true, true, changePwd.UniqueID); string javascript = "javascript:" + Page.ClientScript.GetPostBackEventReference(options); javascript = Page.Server.HtmlEncode(javascript); Extender.WriteSubmit(writer, changePwd.ChangePasswordButtonType, changePwd.ChangePasswordButtonStyle.CssClass, changePwd.ChangePasswordTemplateContainer.ID + "_" + id, changePwd.ChangePasswordButtonImageUrl, javascript, changePwd.ChangePasswordButtonText); } id = "Cancel"; id += (changePwd.ChangePasswordButtonType == ButtonType.Button) ? "Push" : ""; idWithType = WebControlAdapterExtender.MakeIdWithButtonType(id, changePwd.CancelButtonType); btn = changePwd.ChangePasswordTemplateContainer.FindControl(idWithType); if (btn != null) { Page.ClientScript.RegisterForEventValidation(btn.UniqueID); Extender.WriteSubmit(writer, changePwd.CancelButtonType, changePwd.CancelButtonStyle.CssClass, changePwd.ChangePasswordTemplateContainer.ID + "_" + id, changePwd.CancelButtonImageUrl, "", changePwd.CancelButtonText); } WebControlAdapterExtender.WriteEndDiv(writer); }
internal ChangePasswordDeafultTemplate (ChangePassword cPassword) { _owner = cPassword; }
private void WriteUserPanel(HtmlTextWriter writer, ChangePassword changePwd) { if (changePwd.DisplayUserName) { TextBox textbox = changePwd.ChangePasswordTemplateContainer.FindControl("UserName") as TextBox; if (textbox != null) { Page.ClientScript.RegisterForEventValidation(textbox.UniqueID); WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-ChangePassword-UserPanel", ""); Extender.WriteTextBox(writer, false, changePwd.LabelStyle.CssClass, changePwd.UserNameLabelText, changePwd.TextBoxStyle.CssClass, changePwd.ChangePasswordTemplateContainer.ID + "_UserName", changePwd.UserName); WebControlAdapterExtender.WriteRequiredFieldValidator(writer, changePwd.ChangePasswordTemplateContainer.FindControl("UserNameRequired") as RequiredFieldValidator, changePwd.ValidatorTextStyle.CssClass, "UserName", changePwd.UserNameRequiredErrorMessage); WebControlAdapterExtender.WriteEndDiv(writer); } } }
/// <summary> /// Writes the failure panel. /// </summary> /// <param name="writer"> /// The writer. /// </param> /// <param name="changePwd"> /// The change PWD. /// </param> /// <remarks> /// </remarks> private static void WriteFailurePanel(HtmlTextWriter writer, ChangePassword changePwd) { var className = (!String.IsNullOrEmpty(changePwd.FailureTextStyle.CssClass)) ? changePwd.FailureTextStyle.CssClass + " " : string.Empty; className += "AspNet-ChangePassword-FailurePanel"; WebControlAdapterExtender.WriteBeginDiv(writer, className, string.Empty); WebControlAdapterExtender.WriteSpan(writer, string.Empty, changePwd.ChangePasswordFailureText); WebControlAdapterExtender.WriteEndDiv(writer); }