Views: 2463
Number of votes: 6
Average rating:

Placeholder text for property editors

Last week I ran into a (slightly hidden) feature in EPiServer that I think could be quite useful in many scenarios. So let's share it! 

What I found it that it's possible to add placeholder/watermark text to the property editors. That is accomplished by setting the "Promt" property on the "Display" attribute for the property. So this code:

 [Display(Prompt = "Enter title here")]
 public virtual string Title { get; set; }

Would generate this:

The caveat to all this is that it will only work for "simple" property editors. I tested it on basic textboxes and date selectors, and it worked great. However, for more complex ones, e.g. a content area editor, the placeholder text will not be shown.

Sep 21, 2015

(By valdis, 9/21/2015 6:30:28 PM)


(By per.nergard, 9/21/2015 10:09:24 PM)

Nice! To bad it doesn't work for contentareas.

Please login to comment.