How to display in content tree another value than this which is saved in the database?

Michał Gajdziel asked on September 24, 2018 10:40

In page type app I have simple "User selector" field. I want to save UserID in DB and in the same moment I want to display e. g. "Full Name" in content tree. Which way is the best way to solve this problem?

Correct Answer

David te Kloese answered on September 27, 2018 14:04

So what is the goal? Do you want it just in display of the Tree in the pages? But not update the node title an or alias?

  • So Userid: 111
  • page display in Kentico admin tree: Andrew Jones
  • Page title : 111
  • Page alias : /111

There is no out of the box solution, but you might be able to update Kentico source file at:

~/CMSModules/Content/Controls/ContentTree.ascx.cs

at line 900 nodeName is being set. So based on page type and or other logic you probably can replace it with a full name.

Note that adjusting Kentico files is NOT advised especially because of possible issues during upgrades or hotfixes.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Dragoljub Ilic answered on September 24, 2018 11:03

Hi,

You can use Uni selector control and for object type use cms.user. When you click on 'Advanced' arrow you can fill in Display name format field with {% FullName %} which will return only Full Name of a user. For Return column name add simple UserID value.

Best regards, Dragoljub

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on September 24, 2018 11:11

What Dragoljub said, I was creating screenshot sample for you ^_^

Image Text

The User Selector is most common, and works with ID.

The one on the right is with Uni selector, (I've used the UserGuid as they are unique in case you export data) but you can also use other types.

0 votesVote for this answer Mark as a Correct answer

Michał Gajdziel answered on September 27, 2018 11:57

Thank you guys for answering. I'm not interesting with display format in Form section. I want to change display format in Content tree view:

Image Text

I checked most of the fields and I didn't find any option to change display format in Content tree view. It's always Return column

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.