So the below code works perfectly fine for the front-end however always returns null/0 in the back-office when rendered within the grid.
This code is within a custom grid editor.
int pageid = Convert.ToInt32(UmbracoContext.Current.PageId);
How can I make it work from backoffice to?