Szerkesztés

Megosztás a következőn keresztül:


PasswordRecovery.TextLayout Property

Definition

Gets or sets a value that specifies whether to display the PasswordRecovery control in a horizontal or vertical layout.

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

Property Value

One of the LoginTextLayout enumeration values. The default is TextOnLeft.

Exceptions

The TextLayout property is not set to a valid LoginTextLayout enumeration value.

Examples

The following code example shows how changing the TextLayout property affects the appearance of 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">
    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>

Remarks

The TextLayout property specifies where the PasswordRecovery control displays the field labels for the Answer, Question, and User Name text boxes. When the TextLayout property is set to TextOnLeft (the default), the field labels appear to the left of the text boxes. When TextLayout is set to TextOnTop, the field labels appear above the text boxes.

The text of the labels is specified in the AnswerLabelText, QuestionLabelText, and UserNameLabelText properties, respectively. The style settings for the field labels are specified in the LabelStyle property.

Applies to

See also