PasswordRecovery.TextLayout 属性

定义

获取或设置一个值,该值指定是以水平布局还是垂直布局显示 PasswordRecovery 控件。

public:
 virtual property System::Web::UI::WebControls::LoginTextLayout TextLayout { System::Web::UI::WebControls::LoginTextLayout get(); void set(System::Web::UI::WebControls::LoginTextLayout value); };
public virtual System.Web.UI.WebControls.LoginTextLayout TextLayout { get; set; }
member this.TextLayout : System.Web.UI.WebControls.LoginTextLayout with get, set
Public Overridable Property TextLayout As LoginTextLayout

属性值

LoginTextLayout 枚举值之一。 默认值为 TextOnLeft

例外

未将 TextLayout 属性设置为有效的 LoginTextLayout 枚举值。

示例

下面的代码示例演示更改 TextLayout 属性如何影响控件的外观 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">
    void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedValue == "TextOnLeft") 
        {
            PasswordRecovery1.TextLayout = LoginTextLayout.TextOnLeft;
        }
        if (DropDownList1.SelectedValue == "TextOnTop")
        {
            PasswordRecovery1.TextLayout = LoginTextLayout.TextOnTop;
        }
    }
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">
            <table border="1">
                <tr>
                    <td> Choose text layout: 
                        <asp:dropdownlist id="DropDownList1" runat="server"
                            autopostback="true" onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                            <asp:listitem value="TextOnLeft">Left</asp:listitem>
                            <asp:listitem value="TextOnTop">Top</asp:listitem>
                        </asp:dropdownlist>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:passwordrecovery id="PasswordRecovery1" runat="server" 
                            textlayout="TextOnLeft">
                        </asp:passwordrecovery>
                    </td>
                </tr>
            </table>
        </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">
    Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        If DropDownList1.SelectedValue = "TextOnLeft" Then
            PasswordRecovery1.TextLayout = LoginTextLayout.TextOnLeft
        End If
        If DropDownList1.SelectedValue = "TextOnTop" Then
            PasswordRecovery1.TextLayout = LoginTextLayout.TextOnTop
        End If
    End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">
            <table border="1">
                <tr>
                    <td> Choose text layout: 
                        <asp:dropdownlist id="DropDownList1" runat="server"
                            autopostback="true" onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                            <asp:listitem value="TextOnLeft">Left</asp:listitem>
                            <asp:listitem value="TextOnTop">Top</asp:listitem>
                        </asp:dropdownlist>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:passwordrecovery id="PasswordRecovery1" runat="server" 
                            textlayout="TextOnLeft">
                        </asp:passwordrecovery>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

注解

属性 TextLayout 指定控件显示“答案”、“问题”和“用户名”文本框的字段标签的位置 PasswordRecoveryTextLayout当 属性设置为 TextOnLeft (默认) 时,字段标签将显示在文本框的左侧。 当 设置为 TextOnTopTextLayout,字段标签将显示在文本框上方。

标签的文本分别在 AnswerLabelTextQuestionLabelTextUserNameLabelText 属性中指定。 字段标签的样式设置在 属性中 LabelStyle 指定。

适用于

另请参阅