DisplayAttribute.Prompt Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value that will be used to set the watermark for prompts in the UI.
public:
property System::String ^ Prompt { System::String ^ get(); void set(System::String ^ value); };
public string Prompt { get; set; }
public string? Prompt { get; set; }
member this.Prompt : string with get, set
Public Property Prompt As String
Property Value
A value that will be used to display a watermark in the UI.
Examples
The following example shows how to set the Prompt property to "Enter Last Name".
[MetadataType(typeof(EmployeeMD))]
public partial class Employee {
public class EmployeeMD {
[Display(Name = "Last Name", Order = -9,
Prompt = "Enter Last Name", Description="Emp Last Name")]
public object LastName { get; set; }
[Display(Name = "Manager", AutoGenerateFilter=false)]
public object Employee1 { get; set; }
}
}
<MetadataType(GetType(EmployeeMD))> _
Public Class Employee
Public Class EmployeeMD
<Display(Name:="Last Name", Order:=-9, _
Prompt:="Enter Last Name", Description:="Emp Last Name")> _
Public Property LastName As Object
End Property
<Display(Name:="Manager", AutoGenerateFilter:=false)> _
Public Property Employee1 As Object
End Property
End Class
End Class
Remarks
This property is typically used as a prompt or watermark for a UI element that is bound to the property that is annotated with this attribute. Do not use this method to access the prompt string. Use the GetPrompt method instead.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應