I'm trying to access the submit button which is part of the PasswordRecovery control within asp.net 2.0. The API as far as I can see does not allow this.
Has anyone any ideas how I can add a Javascript confirmation popup window when clicking this button.
I have tried to add onclick to the attributes of the PasswordRecovery control within the SendingMail event as below but no luck.
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
//storing audit information
PasswordRecovery myPasswordRecovery = new PasswordRecovery();
myPasswordRecovery = (PasswordRecovery)sender;
myPasswordRecovery.SubmitButton.Attributes.Add("onclick", "return confirm('" + confirmationMessage + "');");
}
From stackoverflow
-
Are you specifying the template when attempting to access the button, e.g:
passwordRecovery.UserNameTemplateContainer.FindControl("submitButton") -
I would attempt to template the control and replace the submit button.
<asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit" ValidationGroup="PasswordRecovery1" OnClientClick="return confirm('You sure you want to recover?');" />
0 comments:
Post a Comment