PasswordRecovery.FailureTextStyle Property

 

Gets a reference to a collection of properties that define the appearance of error text in the PasswordRecovery control.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
public TableItemStyle FailureTextStyle { get; }

Property Value

Type: System.Web.UI.WebControls.TableItemStyle

A reference to the TableItemStyle that contains properties that define the appearance of error text.

The FailureTextStyle property defines the appearance of error messages in the PasswordRecovery control. This property is read-only; however, you can set the properties of the Style object it returns. You can set these properties declaratively in the form Property-Subproperty, where Subproperty represents a property of the Style class (for example, FailureTextStyle-ForeColor). You can set the property programmatically in the form Property.Subproperty (for example, FailureTextStyle.ForeColor).

Common settings include custom background color, text color, and font properties. The FailureTextStyle property defines the appearance of the following properties:

The style settings for the FailureTextStyle property are merged with the style settings for the PasswordRecovery control. Any settings made in the FailureTextStyle property override the corresponding settings in properties of the PasswordRecovery control.

The following PasswordRecovery style properties are overridden by FailureTextStyle settings:

When you use templates to define the appearance of the PasswordRecovery control, the FailureTextStyle property has no effect.

The following code example uses the FailureTextStyle property to set the style property for error messages in the PasswordRecovery control.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:PasswordRecovery id="PasswordRecovery1" runat="server" 
            GeneralFailureText="You password cannot be retrieved at this time. Please try again later." 
            QuestionFailureText="Your answer does not match the stored answer. Please try again." 
            UserNameFailureText="We couldn't find that user name. Please try again.">
            <FailureTextStyle backcolor="Red" forecolor="White"></FailureTextStyle>
        </asp:PasswordRecovery>
    </form>
</body>
</html>

.NET Framework
Available since 2.0
Return to top
Show: