Datagrid lookup column based on a class

I have a bound column which, in the EditTemplate, uses a dropdown component, and this all works fine. The column is used to select a row type, so if the user selects "Commodity", the value "COM" is stored.

When not in edit mode, I would like to show "Commodity" in the column, not "COM", so I'm trying to use Template to reference the class I use in the dropdown, but I can't get it to work?

The class is defined as:

TbiLotType lottypes = new TbiLotType();

And in the Class constructor I have:

public List TbiLotTypes()
{
return new List
{
new TbiLotType { TypeCode="COM",TypeName="Commodity" },
new TbiLotType { TypeCode="SRV",TypeName="Service" }
};
}

As I say, all works fine in edit mode via a dropdown.

Cheers
Reg

Hi @SolutionJ,

The template should be set to find the corresponding item from the collection based on the current value. Something like this:

<Template Context="data">
   @(lottypes.TbiLotTypes().FirstOrDefault(l => l.TypeCode == data.TypeCode)?.TypeName)
</Template>

Brilliant, many thanks korchev...