This documentation is archived and is not being maintained.

How to: Customize the PasswordRecovery Control

You can customize the PasswordRecovery control in the following ways:

  • You can edit the displayed templates and change the control's user interface (UI).

  • You can apply an ASP.NET theme to the control. For more information, see ASP.NET Themes and Skins Overview.

  • You can use the control's properties (such as QuestionLabelText or InstructionTextStyle).to modify its appearance. For details, see the properties of the PasswordRecovery control in the class library reference.

This topic describes how to customize the System.Web.UI.WebControls.PasswordRecovery control using templates.

To edit the PasswordRecovery templates

  1. Add a PasswordRecovery control to the page as shown in the following code example.

    <asp:PasswordRecovery ID="PasswordRecovery1" Runat="server">
    </asp:PasswordRecovery>
    
  2. You can apply styles to customize the appearance of the PasswordRecovery control. Use properties to apply any desired styles to the template, such as the LabelStyle, HyperLinkStyle, and TitleTextStyle properties.

    To customize the content of the PasswordRecovery control, continue with the following steps to modify the templates used by the PasswordRecovery control.

  3. Create a UserNameTemplate template to specify the markup and controls that appear when the control is first rendered, as shown in the following code example.

    Security noteSecurity Note

    This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

    No code example is currently available or this language may not be supported.
  4. Create a QuestionTemplate template to specify the markup and controls that appear when the control prompts the user for the security question, as shown in the following code example.

    Security noteSecurity Note

    This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

    No code example is currently available or this language may not be supported.
  5. Create a SuccessTemplate template to specify the markup and controls that appear when a user has successfully retrieved a password

    The following code example shows the markup for a PasswordRecovery control with a SuccessTemplate template defined.

    Security noteSecurity Note

    This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

    No code example is currently available or this language may not be supported.

See Also

Show: