-
Notifications
You must be signed in to change notification settings - Fork 806
Entity Framework LookupEditorAttribute [PropertyGrid]
Victor Tomaili edited this page May 3, 2021
·
1 revision
[namespace: Serenity.ComponentModel] - [assembly: Serenity.Core]
This attribute can be used to add a lookup editor for data from an external table.
Attribute definition:
public class LookupEditorAttribute : LookupEditorBaseAttribute
{
public LookupEditorAttribute(string lookupKey);
//
// Summary:
// If you use this constructor, lookupKey will be determined by [LookupScript] attribute
// on specified lookup type. If this is a row type, make sure it has [LookupScript]
// attribute on it.
public LookupEditorAttribute(Type lookupType);
}
Use:
As sou seen if you use the constructor with lookupType parameter, see also the [LookupScriptAttribute](LookupScriptAttribute [Extensibility]).
This editor gets data from the specified table and makes them available in a dropdown list.
public sealed class CustomerRow : Row, IIdRow, INameRow
{
[...]
[LookupEditor(typeof(EmployeeRow))]
public Int32? LastContactedBy
{
get { return Fields.LastContactedBy[this]; }
set { Fields.LastContactedBy[this] = value; }
}
[...]
See also:
Copyright © Serenity Platform 2017-present. All rights reserved.
Documentation | Serene Template | Live Demo | Premium Support | Issues | Discussions