获取或设置当用户名字段为空时在 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 ExamplePasswordRequiredErrorMessage="You must enter a password." UserNameRequiredErrorMessage="You must enter a user name."> | runat="server" ValidationGroup="Login1" > |
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.
适用于
另请参阅