Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've made my own grid layout page - a copy of Bootstrap3.cshtml. I'm trying to get the current page (or a specific page). How can I do that? Looks like it needs "Umbraco.Web.Mvc.UmbracoTemplatePage", but this isn't a template. Any ideas?
I found out how - from stack overflow.
umbraco.NodeFactory.Node node = uQuery.GetNodesByName("Page Name").FirstOrDefault();
Sorry Leon but I dont think your answer is correct because you are getting all pages with the same name ? so if you got more nodes in backend called the same as your homepage it will get more results back, for the most part I would guess it always will be the first in the list because you had created the homepage first, but I dont like the way you get the node because there is a possible risk it will get the worng node..
I like Marcelo version insted ! :D
I was looking for a way to get the current page inside my grid framework. I tried your solution, but for what I was trying to accomplish that solution did not help me.
I found another way, including this line inside my framework grid:
IPublishedContent currentPage = UmbracoContext.PublishedContentRequest.PublishedContent;
As I don't know Umbraco very well, Please, someone could confirm if this approach is acceptable? Will I have problems in future for my website?
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted