Login.TitleText Proprietà

Definizione

Ottiene o imposta il titolo del controllo Login.

public:
 virtual property System::String ^ TitleText { System::String ^ get(); void set(System::String ^ value); };
public virtual string TitleText { get; set; }
member this.TitleText : string with get, set
Public Overridable Property TitleText As String

Valore della proprietà

String

Titolo del controllo Login. L'impostazione predefinita è "Login".

Esempio

Nell'esempio di codice seguente viene impostata la TitleText proprietà .

Importante

Questo esempio contiene una casella di testo che accetta l'input dell'utente, che rappresenta una potenziale minaccia per la sicurezza. Per impostazione predefinita, le pagine Web ASP.NET verificano che l'input dell'utente non includa script o elementi HTML. Per altre informazioni, vedere Cenni preliminari sugli attacchi tramite script.

<%@ 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 changeClick(object sender, EventArgs e)
{
    Login1.TitleText = newTitle.Text;
}

void OnLoginError(object sender, EventArgs e)
{
    Login1.TitleTextStyle.BackColor = System.Drawing.Color.Red;
}

</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 style="text-align:center; border:1">
                <tr>
                    <td>
                        Title Text:
                    </td>
                    <td>
                        <asp:TextBox id="newTitle" runat="server">Login</asp:TextBox></td>
                    <td>
                        <asp:Button id="change" runat="server" onClick="changeClick" Text="Change"></asp:Button></td>
                </tr>
                <tr>
                    <td colspan="3" align="center">
                        <asp:Login id="Login1" runat="server" 
                            TitleText="Log In Now"
                            OnLoginError="OnLoginError">
                            <TitleTextStyle 
                                Font-Bold="True" 
                                ForeColor="#0000C0" 
                                BackColor="#E0E0E0">
                        </TitleTextStyle>
                        </asp:Login>
                    </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 changeClick(ByVal sender As Object, ByVal e As EventArgs)
    Login1.TitleText = newTitle.Text
End Sub

Sub OnLoginError(ByVal sender As Object, ByVal e As EventArgs)
    Login1.TitleTextStyle.BackColor = System.Drawing.Color.Red
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 style="text-align:center; border:1">
                <tr>
                    <td>
                        Title Text:
                    </td>
                    <td>
                        <asp:TextBox id="newTitle" runat="server">Login</asp:TextBox></td>
                    <td>
                        <asp:Button id="change" runat="server" onClick="changeClick" Text="Change"></asp:Button></td>
                </tr>
                <tr>
                    <td colspan="3" align="center">
                        <asp:Login id="Login1" runat="server" 
                            TitleText="Log In Now"                            
                            OnLoginError="OnLoginError">
                            <TitleTextStyle 
                                Font-Bold="True" 
                                ForeColor="#0000C0" 
                                BackColor="#E0E0E0">
                        </TitleTextStyle>
                        </asp:Login>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

Commenti

La TitleText proprietà specifica il titolo visualizzato nella parte superiore del Login controllo.

Il testo predefinito per il controllo viene localizzato in base alle impostazioni locali correnti del server.

Il valore di questa proprietà, se impostato, può essere salvato automaticamente in un file di risorse usando uno strumento di progettazione. Per altre informazioni, vedere LocalizableAttribute Globalizzazione e localizzazione.

Si applica a

Vedi anche