Login.LoginButtonText Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает текст для Login кнопки входа элемента управления.
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
Значение свойства
Текст, используемый для Login кнопки входа элемента управления. Значение по умолчанию — "Имя входа".
Примеры
В следующем примере кода показано, как текст в LoginButtonText свойстве влияет на значение LoginButtonType свойства.
Это важно
В этом примере содержится текстовое поле, которое принимает входные данные пользователя, которое является потенциальной угрозой безопасности. По умолчанию ASP.NET веб-страницы проверяют, что входные данные пользователя не включают скрипт или ЭЛЕМЕНТЫ HTML. Дополнительные сведения см. в разделе "Обзор эксплойтов скриптов".
<%@ 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>
Комментарии
Свойство LoginButtonText содержит текст, отображаемый для Login кнопки входа элемента управления. В зависимости от значения LoginButtonType свойства LoginButtonText свойство может отображаться как текст на кнопке, как текст, отображаемый в качестве альтернативы изображению в браузерах, которые не отображают изображения или как текст ссылки. В следующей таблице описывается, как различные LoginButtonType значения влияют на LoginButtonText свойство.
| Настройка LoginButtonType | LoginButtonText Как используется свойство. |
|---|---|
| Button | Как свойство кнопки Text . |
| Image | В качестве альтернативного текста для изображения. |
| Link | Как текст ссылки. |
Текст по умолчанию для элемента управления локализован на основе текущего языкового стандарта сервера.
Значение этого свойства, если задано, можно автоматически сохранить в файл ресурсов с помощью средства конструктора. Дополнительные сведения см. в статье LocalizableAttribute и глобализации и локализации.