loginrequired注解_Login.UserNameRequiredErrorMessage 属性 (System.Web.UI.WebControls) | Microsoft Docs...

获取或设置当用户名字段为空时在 ValidationSummary 控件中显示的错误消息。Gets or sets the error message to display in a ValidationSummary control when the user name field is left blank.

public:

virtual property System::String ^ UserNameRequiredErrorMessage { System::String ^ get(); void set(System::String ^ value); };

public virtual string UserNameRequiredErrorMessage { get; set; }

member this.UserNameRequiredErrorMessage : string with get, set

Public Overridable Property UserNameRequiredErrorMessage As String

属性值

当用户名字段为空时在 ValidationSummary 控件中显示的错误消息。The error message to display in a ValidationSummary control when the user name field is left blank. 默认值为“用户名。”The default is "User Name."

示例

The following code example demonstrates using a ValidationSummary control to display the error message specified in the UserNameRequiredErrorMessage property.

ASP.NET Example

PasswordRequiredErrorMessage="You must enter a password."

UserNameRequiredErrorMessage="You must enter a user name.">

runat="server" ValidationGroup="Login1" >

ASP.NET Example

PasswordRequiredErrorMessage="You must enter a password."

UserNameRequiredErrorMessage="You must enter a user name.">

ValidationGroup="Login1" runat="server">

注解

The UserNameRequiredErrorMessage property contains the error message displayed in a ValidationSummary control on the login page.

The UserNameRequiredErrorMessage property value is displayed only when both the following conditions are true:

A ValidationSummary control is present on the page.

用户的 "用户名" 文本框留空。The User name text box is left blank by the user.

控件的默认文本根据服务器当前的区域设置进行本地化。The default text for the control is localized based on the server's current locale.

设置此属性后,可以使用设计器工具自动将此属性的值保存到资源文件中。The value of this property, when set, can be saved automatically to a resource file by using a designer tool.

Both the PasswordRequiredErrorMessage and UserNameRequiredErrorMessage values are wrapped in a validation group within the Login control. For these values to display, the ValidationGroup property of the ValidationSummary control must be set to the ID property of the Login control.

适用于

另请参阅

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值