Getting a previewable property value with UIHint.PreviewableText

You might have seen that the field “Name in URL” first gives you the value and the editor needs to click “change” to edit it.
nameinurl

You can also accomplish this on your normal string properties by using the UI Hint “previewabletext” (also found as the constant UIHint.PreviewableText).

[Display(Name = "My Property")]
[UIHint(UIHint.PreviewableText)]
public virtual string MyProperty { get; set; }

And it will look like this:
previewable

Leave a comment