SelectItemAttribute class
namespace: Serenity.ComponentModel assembly: Serenity.Net.Core
Declares an item of a "Select" editor, see SelectEditorAttribute, on the property that the editor belongs to, e.g. [SelectItem("low", TextKey = "Controls.Priority.Low")]. The items of a property imply the editor, so the property does not need a SelectEditorAttribute as well.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
public class SelectItemAttribute : Attribute, IHasTextKey
Public Members
| name | description |
|---|---|
| SelectItemAttribute(…) | Creates a new instance of the SelectItemAttribute class. |
| CssClass { get; set; } | The CSS class of the item, e.g. "text-danger", which the editor adds to the item in its results. |
| Icon { get; set; } | The icon of the item, e.g. "fa fa-truck", which the editor shows before its text. |
| Order { get; set; } | The order of the item among the items of the property, as the order of the attributes of a property is not guaranteed. Default is zero, and the items with the same order keep the order of their attributes. |
| Text { get; set; } | The text of the item, which is shown as it is, and which the local text of TextKey falls back to when there is no text for it. When neither is set, the value of the item is its text. |
| TextKey { get; set; } | The local text key of the item, which the editor localizes. When it is not set, an item that has a text takes the key that its form implies for it, e.g. Forms.Namespace.MyForm.Priority_SelectItem_low. An empty string leaves the item as it is, which is what an item whose text is a name, e.g. a company, needs. |
| Value { get; } | The value of the item, which the editor sets on its field, and which the client knows as the id of the item. |
See Also
- interface IHasTextKey
- Source: SelectItemAttribute.cs