PasswordRecovery.UserNameTitleText 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置 PasswordRecovery 控件的“用户名”视图的标题。
public:
virtual property System::String ^ UserNameTitleText { System::String ^ get(); void set(System::String ^ value); };
public virtual string UserNameTitleText { get; set; }
member this.UserNameTitleText : string with get, set
Public Overridable Property UserNameTitleText As String
属性值
“用户名”视图的标题。 默认值为“Forgot Your Password?”(是否忘记了您的密码?)
示例
下面的代码示例设置 属性 UserNameTitleText 。 如果用户未输入有效的用户名,则会 UserNameTitleText 在 事件中 UserLookupError 重置 属性。
<%@ 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 PasswordRecovery1_UserLookupError(object sender, EventArgs e)
{
PasswordRecovery1.UserNameTitleText = "Try again";
PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red;
}
void PasswordRecovery1_AnswerLookupError(object sender, EventArgs e)
{
PasswordRecovery1.QuestionTitleText = "Try again";
PasswordRecovery1.TitleTextStyle.ForeColor = 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">
<asp:passwordrecovery id="PasswordRecovery1" runat="server"
questiontitletext="Password Confirmation Question"
usernametitletext="Get a new password" OnUserLookupError="PasswordRecovery1_UserLookupError" OnAnswerLookupError="PasswordRecovery1_AnswerLookupError">
<titletextstyle
font-names="Arial"
font-bold="True"
forecolor="White"
backcolor="Gray">
</titletextstyle>
</asp:passwordrecovery>
</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 PasswordRecovery1_UserLookupError(ByVal sender As Object, ByVal e As System.EventArgs)
PasswordRecovery1.UserNameTitleText = "Try again"
PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red
End Sub
Sub PasswordRecovery1_AnswerLookupError(ByVal sender As Object, ByVal e As System.EventArgs)
PasswordRecovery1.QuestionTitleText = "Try again"
PasswordRecovery1.TitleTextStyle.ForeColor = 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">
<asp:passwordrecovery id="PasswordRecovery1" runat="server"
questiontitletext="Password Confirmation Question"
usernametitletext="Get a new password" OnUserLookupError="PasswordRecovery1_UserLookupError" OnAnswerLookupError="PasswordRecovery1_AnswerLookupError">
<titletextstyle
font-names="Arial"
font-bold="True"
forecolor="White"
backcolor="Gray">
</titletextstyle>
</asp:passwordrecovery>
</form>
</body>
</html>
注解
属性 UserNameTitleText 包含要显示为 UserName 视图标题的文本,该视图要求用户输入其用户名。
属性中的 TitleTextStyle 样式设置定义 属性中 UserNameTitleText 文本的外观。
使用 UserNameTemplate 属性定义 UserName 视图的外观时,该 UserNameTitleText 属性无效。
属性的默认文本根据服务器的区域设置进行本地化。
设置此属性的值后,可以使用设计器工具自动保存到资源文件。 有关详细信息,请参阅 LocalizableAttribute 和 全球化和本地化。