Login.LoginButtonText Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece el texto Login del botón de inicio de sesión del control.
public:
virtual property System::String ^ LoginButtonText { System::String ^ get(); void set(System::String ^ value); };
public virtual string LoginButtonText { get; set; }
member this.LoginButtonText : string with get, set
Public Overridable Property LoginButtonText As String
Valor de propiedad
Texto usado para el Login botón de inicio de sesión del control. El valor predeterminado es "Login".
Ejemplos
En el ejemplo de código siguiente se muestra cómo afecta el texto de la LoginButtonText propiedad al valor de la LoginButtonType propiedad .
Importante
Este ejemplo contiene un cuadro de texto que acepta la entrada del usuario, que es una amenaza de seguridad potencial. De forma predeterminada, ASP.NET páginas web validan que la entrada del usuario no incluye elementos HTML ni de script. Para obtener más información, consulte Información general sobre vulnerabilidades de seguridad de script.
<%@ Page Language="C#" AutoEventWireup="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void changeButton_Click(Object sender, EventArgs e)
{
if (ChooseButtonType.SelectedValue == "Button")
{
Login1.LoginButtonType = ButtonType.Button;
}
if (ChooseButtonType.SelectedValue == "Image")
{
Login1.LoginButtonType = ButtonType.Image;
}
if (ChooseButtonType.SelectedValue == "Link")
{
Login1.LoginButtonType = ButtonType.Link;
}
Login1.LoginButtonText = Server.HtmlEncode(buttonText.Text);
}
</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>
<tr>
<td>Login Button Text:
</td>
<td>
<asp:TextBox id="buttonText"
runat="server"
Text="Login"></asp:TextBox>
</td>
<td>Button Type:
</td>
<td>
<asp:DropDownList id="ChooseButtonType"
runat="server">
<asp:ListItem value="Button"
selected="true"></asp:ListItem>
<asp:ListItem value="Image"></asp:ListItem>
<asp:ListItem value="Link"></asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:Button id="changeButton" runat="server" Text="Change" OnClick="changeButton_Click"></asp:Button>
</td>
</tr>
<tr>
<td colspan="4"
align="center">
<asp:Login id="Login1"
runat="server"
LoginButtonType="Image"
LoginButtonText="Log in to Web Site."
LoginButtonImageUrl="images\login.png">
</asp:Login>
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub changeButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If (ChooseButtonType.SelectedValue = "Button") Then
Login1.LoginButtonType = System.Web.UI.WebControls.ButtonType.Button
End If
If (ChooseButtonType.SelectedValue = "Image") Then
Login1.LoginButtonType = System.Web.UI.WebControls.ButtonType.Image
End If
If (ChooseButtonType.SelectedValue = "Link") Then
Login1.LoginButtonType = System.Web.UI.WebControls.ButtonType.Link
End If
Login1.LoginButtonText = Server.HtmlEncode(buttonText.Text)
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>
<tr>
<td>Login Button Text:
</td>
<td>
<asp:TextBox id="buttonText"
runat="server"
Text="Login"></asp:TextBox>
</td>
<td>Button Type:
</td>
<td>
<asp:DropDownList id="ChooseButtonType"
runat="server">
<asp:ListItem value="Button"
selected="true"></asp:ListItem>
<asp:ListItem value="Image"></asp:ListItem>
<asp:ListItem value="Link"></asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:Button id="changeButton" runat="server" Text="Change" OnClick="changeButton_Click"></asp:Button>
</td>
</tr>
<tr>
<td colspan="4"
align="center">
<asp:Login id="Login1"
runat="server"
LoginButtonType="Image"
LoginButtonText="Log in to Web Site."
LoginButtonImageUrl="images\login.png">
</asp:Login>
</td>
</tr>
</table>
</form>
</body>
</html>
Comentarios
La LoginButtonText propiedad contiene el texto que se muestra para el Login botón de inicio de sesión del control. Según el valor de la LoginButtonType propiedad, la LoginButtonText propiedad puede aparecer como texto en un botón, como texto que se muestra como alternativa a una imagen en exploradores que no representan imágenes o como texto de un vínculo. En la tabla siguiente se describe cómo afectan los distintos LoginButtonType valores a la LoginButtonText propiedad .
| configuración de LoginButtonType | Cómo se usa la LoginButtonText propiedad . |
|---|---|
| Button | Como propiedad del Text botón. |
| Image | Como texto alternativo para la imagen. |
| Link | Como texto de vínculo. |
El texto predeterminado del control se localiza en función de la configuración regional actual del servidor.
El valor de esta propiedad, cuando se establece, se puede guardar automáticamente en un archivo de recursos mediante una herramienta de diseñador. Para obtener más información, consulte LocalizableAttributeGlobalización y localización.