David G
David G

Reputation: 5

Kentico 10 Uniselector display custom field

I am looking for a solution to display a field of a pagetype in a uniselector.

My current setup

Upvotes: 0

Views: 796

Answers (3)

Trevor F
Trevor F

Reputation: 1437

You may need to add a UniGrid extender class to render that column and do a lookup on the value manually.

https://docs.kentico.com/k10/custom-development/creating-custom-modules/creating-extenders-for-module-interface-pages

Upvotes: 0

Tom Troughton
Tom Troughton

Reputation: 4325

Since I don't believe this is possible with a Uni Selector, have you considered trying a List Box control instead? This one lets you define a SQL SELECT so you have full control over the data displayed. For example, set the Data source to be a SQL Query similar to this:

SELECT DocumentID, DocumentName, MyCustomField FROM dbo.Namespace_MyTable a
INNER JOIN dbo.CMS_Document b ON a.MyTableID = b.DocumentForeignKeyValue
INNER JOIN dbo.CMS_Tree c ON b.DocumentNodeID = c.NodeID AND c.NodeClassID = 1
-- Make sure NodeClassID has the correct value from dbo.CMS_Class

Then your Text format field can be something like {%DocumentName%} {%MyCustomField%}

I've tested this and it works. Might not suit your needs precisely but hopefully gets you closer than a uni selector is capable of.

Upvotes: 0

Tom Troughton
Tom Troughton

Reputation: 4325

I believe you can reference the field in the same way as DocumentName as long as you've added the custom field name to the uni selector's "Additional columns" field (you need to expand the Advanced options).

  • Display name format: {%DocumentName%} {%MyCustomField%}
  • Additional columns: MyCustomField

Upvotes: 1

Related Questions