Login.TitleText Propriété

Définition

Obtient ou définit le titre du contrôle 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

Valeur de propriété

String

Titre du contrôle Login. La valeur par défaut est "Connexion".

Exemples

L’exemple de code suivant définit la TitleText propriété.

Important

Cet exemple contient une zone de texte qui accepte l’entrée utilisateur, qui est une menace de sécurité potentielle. Par défaut, les pages web ASP.NET vérifient que l’entrée d’utilisateur n’inclut pas de script ou d’éléments HTML. Pour plus d’informations, consultez Vue d’ensemble des attaques de 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>

Remarques

La TitleText propriété spécifie le titre affiché en haut du Login contrôle.

Le texte par défaut du contrôle est localisé en fonction des paramètres régionaux actuels du serveur.

La valeur de cette propriété, quand elle est définie, peut être enregistrée automatiquement dans un fichier de ressources à l’aide d’un outil de concepteur. Pour plus d’informations, consultez LocalizableAttribute et globalisation et localisation.

S’applique à

Voir aussi