Help shape the future of CMS PaaS release notes! Take this quick survey and share your feedback.
AI OnAI Off
Help shape the future of CMS PaaS release notes! Take this quick survey and share your feedback.
Hi,
That's because PageLink is not always an int. In edit mode it also has a work id, so you need to treat PageLink as a string. If you just want the just the id, you can do CurrentPage.PageLink.ID.
Or:
var pageReference = CurrentPage.Property["PageLink"] as PageReference;
var id = pageReference.ID;
The code below only gives the expected result while viewing the page but not in edit mode. Any idea why?
int i;
int.TryParse(CurrentPage.Property["PageLink"], out i);