Published on:Sep 21, 2015
Views: 3510
Number of votes: 7
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 4:30:28 PM)


( 9/21/2015 8:09:24 PM)

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

Please login to comment.