Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
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);