Using template in FK dropdown

Hi,
I see there have been some posts regarding this, but I cannot get this to work. I have a contacts table used to generate dropdown items. By default this uses FirstName. I want to create a template that uses a combination of FirstName + LastName when listing items for selection. None of the suggestions I have found appear to work for me.
Load event:
image
Properties:


I have tried many combinations for the template, eg
${data.FirstName} ${data.LastName}
${((data as Contact).FirstName)} ${((data as Contact).LastName)}

But nothing is working. Anyone able to point me in the right direction here?

Many thanks

According to your screenshot Template is not set.

So if I understand you the right way to want to display a name in the dropdown like this "Firstname Lastname" ?
Can you provide a screenshot on how to contact object looks like?
image

What you can do is press the "Bind" button and paste this in
@($"{data.FirstName} {data.LastName}") and change the "data" to whatever your contact object is called.

Am I understanding you the right way?

Yes, this was just to illustrate the object that I am configuring. Any template options I have tried do not work and so deleted at the moment.

Hi - thanks for your reply. Yes, I want to show "FirstName LastName" in the drop down when selecting the appropriate FK value. I have just found this post:

which actually works with the following syntax:
@(((dynamic)data).FirstName + " " + ((dynamic)data).LastName)
Cheers!

1 Like