Hi. I use Kentico 10. I need to get the NodeId of the current document in Page Type (Data source - SQL Query). But any macros from the CurrentDocument section return an empty string. What could be the problem? Other macros such as {% LocalizationContext.CurrentCulture.CultureCode #%} return data.
{% LocalizationContext.CurrentCulture.CultureCode #%}
Hi,
this is because CurrentDocument context isn't set. As you are about to create a new one anyway.
What you could use is {% EditedObject.NodeID #%} , note that this is NULL when creating a NEW page, as then even the Node isn't there yet.
{% EditedObject.NodeID #%}
Thank you, David! It works.
Please, sign in to be able to submit a new answer.