DisplayAttribute.Prompt Property


Gets or sets a value that will be used to set the watermark for prompts in the UI.

Namespace:   System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public string Prompt { get; set; }

Property Value

Type: System.String

A value that will be used to display a watermark in the UI.

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.

The following example shows how to set the Prompt property to "Enter Last Name".

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; }

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Available since 3.0
Return to top