Bewerken

Delen via


DisplayAttribute.Prompt Property

Definition

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