Skip to content

Grid EditLinkAttribute [Columns]

Victor Tomaili edited this page May 3, 2021 · 1 revision

[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-%5BFormatting%5D)
Clone this wiki locally