DisplayTextAttribute class
namespace: Serenity.ComponentModel assembly: Serenity.Net.Core
Specifies the display text for a property or class. Unlike DisplayNameAttribute, it can specify a local text key.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event)]
public class DisplayTextAttribute : DisplayNameAttribute, IHasTextKey
Public Members
| name | description |
|---|---|
| DisplayTextAttribute() | Initializes a new instance of the DisplayTextAttribute class with no display text. |
| DisplayTextAttribute(…) | Initializes a new instance of the DisplayTextAttribute class with the specified display text. |
| TextKey { get; set; } | Gets or sets the local text key for the display text. |
Examples
[DisplayText("My Display Text", TextKey = "My.Text.Key")] // with key and invariant text [DisplayText(TextKey = "My.Text.Key")] // with only key and no text [DisplayText("My Display Text")] // with only invariant text, no key [DisplayText("Db.Text.Key")] // still with only invariant text, no key unlike DisplayNameAttribute.
See Also
- interface IHasTextKey
- Source: DisplayTextAttribute.cs