Jeff Tung
Jeff Tung

Reputation: 99

Kentico Get Current URL for Page Type Field/Dropdown/Component

I'm trying to create a dynamic page type field, it should able to access correct "Settings" folder to capture the Data Item based on the root (Finance or Procurement):

enter image description here

enter image description here

Let's say the page type being used under Finance, the field should go to 'Finance/Setting/(whatever)'.

What I have done is 'hardcode' the path: enter image description here

enter image description here

I have tried CurrentDocument.DocumentAliasPath, GetDocumentUrl() and so on, it doesn't show anything on the dropdown.

Is there any way to directly get the "Root(Finance or Procurement)" or indirectly get (Chopped from URL, or get URL using GUID)?

Thank you!!

Upvotes: 0

Views: 565

Answers (1)

Anton Grekhovodov
Anton Grekhovodov

Reputation: 287

In page type fields you can use DocumentContext.EditedDocument object to get current page and it's properties. So you can use the following property to get current node name enter image description here

Upvotes: 1

Related Questions