PasswordRecovery.FailureTextStyle 属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取对属性集合的引用,这些属性定义 PasswordRecovery 控件中错误文本的外观。
public:
 property System::Web::UI::WebControls::TableItemStyle ^ FailureTextStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.TableItemStyle FailureTextStyle { get; }[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.FailureTextStyle : System.Web.UI.WebControls.TableItemStylePublic ReadOnly Property FailureTextStyle As TableItemStyle属性值
对包含定义错误文本外观的属性的 TableItemStyle 的引用。
- 属性
示例
下面的代码示例使用 FailureTextStyle 属性设置 控件中错误消息的 PasswordRecovery style 属性。
<%@ 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>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    ' Insert page code here
    '
</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>
        <!-- Insert content here -->
    </form>
</body>
</html>
注解
属性 FailureTextStyle 定义控件中 PasswordRecovery 错误消息的外观。 此属性是只读的;但是,可以设置它返回的对象 Style 的属性。 可以在 窗体 Property-Subproperty中以声明方式设置这些属性,其中 Subproperty 表示 Style 类 (例如 FailureTextStyle-ForeColor) 的属性。 可以在窗体 Property.Subproperty 中以编程方式 (设置 属性, FailureTextStyle.ForeColor 例如,) 。
常见设置包括自定义背景色、文本颜色和字体属性。 属性 FailureTextStyle 定义以下属性的外观:
属性的 FailureTextStyle 样式设置与控件的样式设置 PasswordRecovery 合并。 在 属性中 FailureTextStyle 所做的任何设置都覆盖控件属性 PasswordRecovery 中的相应设置。
设置将覆盖FailureTextStyle以下PasswordRecovery样式属性:
使用模板定义控件的外观 PasswordRecovery 时, FailureTextStyle 属性不起作用。