Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Whenever I request a TemplateID of a node it always returns the correct ID, minus one.
For example: my homepage has ID 1056, but when I try to display it in my view it returns ID 1055..This happens with all document types.
I currently use this to fix:
int currentPageId = Model.Content.TemplateId + 1; //dirty hack
Does anyone have a fix so I don't have to rely on hardcore maths like the hack above? ;)
Hi Marc,
The TemplateID and the NodeID are two different things.
Looking at the code you are after you want to change your code to Model.Content.Id instead of TemplateId.
Nik
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Template ID int is always one too low
Whenever I request a TemplateID of a node it always returns the correct ID, minus one.
For example: my homepage has ID 1056, but when I try to display it in my view it returns ID 1055..This happens with all document types.
I currently use this to fix:
int currentPageId = Model.Content.TemplateId + 1; //dirty hack
Does anyone have a fix so I don't have to rely on hardcore maths like the hack above? ;)
Hi Marc,
The TemplateID and the NodeID are two different things.
Looking at the code you are after you want to change your code to Model.Content.Id instead of TemplateId.
Nik
is working on a reply...