Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lee 1130 posts 3088 karma points
    Jun 21, 2013 @ 16:09
    Lee
    0

    Umbraco 6 Get CurrentPage From Custom Class?

    I have a class that needs to know the CurrentPage? I can get access to the UmbracoHelper by doing this in my class

    var uHelper = new UmbracoHelper(UmbracoContext.Current);

    How do I get the CurrentPage

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Jun 21, 2013 @ 16:46
    Ali Sheikh Taheri
    0

    can you pass the current page to your class?

     

     public static IPublishedContent YourMethod(IPublishedContent currentPage)

    //Your Code Here!
  • Lars-Erik Aabech 349 posts 1100 karma points MVP 8x c-trib
    Jun 21, 2013 @ 16:47
    Lars-Erik Aabech
    0

    Not sure which version it was implemented in, but you've got uHelper.AssignedContentItem if Umbraco found some content on the current url.

  • Lee 1130 posts 3088 karma points
    Jun 21, 2013 @ 17:00
    Lee
    100

    Thanks for the comments. I managed to get around it with a bit of a hack :)

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Jun 21, 2013 @ 17:03
    Ali Sheikh Taheri
    0

    Hi Lee, 

    It would be nice to have your work around here as that can be used by other people in case they need it! 

Please Sign in or register to post replies

Write your reply to:

Draft