EditLinkAttribute [Columns]

Estrusco edited this page Oct 27, 2016 · 1 revision
Clone this wiki locally

[namespace: Serenity.ComponentModel] - [assembly: Serenity.Core]

This attribute can be used to add a link to a column value. For default when the user click on this link, the dialog of the corresponding row is open. Is also possible open a different dialog.

Attribute definition:

    public sealed class EditLinkAttribute : Attribute
    {
        public EditLinkAttribute();
        public EditLinkAttribute(bool value);

        public string CssClass { get; set; }
        public string IdField { get; set; }
        public string ItemType { get; set; }
        public bool Value { get; }
    }

Simple use, on click open Customer dialog:

    public class CustomerColumns
    {
        [EditLink]
        public String CustomerID { get; set; }
        [EditLink]
        public String CompanyName { get; set; }
        [...]

Use for open another dialog

    public class TerritoryColumns
    {
        [...]

        // Open the Region dialog, and the Id value is based on field RegionID
        [EditLink(ItemType = "Northwind.Region", IdField = "RegionID")]
        public String RegionDescription { get; set; }

        [...]

See also: 
* [UrlFormatter](UrlFormatter [Formatting])