PasswordRecovery.FailureTextStyle 屬性

定義

取得定義 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.TableItemStyle
Public ReadOnly Property FailureTextStyle As TableItemStyle

屬性值

TableItemStyle

TableItemStyle 的參考,包含定義錯誤文字外觀的屬性。

屬性

範例

下列程式碼範例會 FailureTextStyle 使用 屬性來設定 控制項中錯誤訊息的 PasswordRecovery 樣式屬性。

<%@ 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 屬性不會有任何作用。

適用於

另請參閱