How can i get a reference to the current page within a view or layout?

Vote:
 

How can i get a reference to the current page within a simple view or layout? I tried "PageReference.SelfReference" but to no avail.

#172800
Dec 12, 2016 19:55
Vote:
 

Hi,

You can either have the current page/reference as a part of a model (check AlloyTech templates for inspiration) or use a bit of code to fetch it. I'd prefer filling in the model with whatever is needed from the controller.

The code alternative would be to get a PageRouteHelper from ServiceLocator and access the Page property.

BR,

Marija

#173134
Edited, Dec 14, 2016 23:36
Vote:
 

Thank you Marija

#173145
Dec 15, 2016 8:29
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.