Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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);