Copied to clipboard

Flag this post as spam?

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


  • andrew shearer 409 posts 517 karma points
    Aug 16, 2013 @ 03:57
    andrew shearer
    0

    umbraco 6 MVC form data hidden variable "uformpostroutevals"

    hi

    I notice that umbraco is maintaining form data in "uformpostroutevals". Is there a helper/provider class for this info that I can use from within a controller action?

    basically, I would like know the umbraco context of the form i.e. a content id or something in that form variable that the content id can be derived from eg url.

    thanks

     

  • andrew shearer 409 posts 517 karma points
    Aug 17, 2013 @ 04:41
    andrew shearer
    0

    in a controller action I could use UmbracoContext.PageId to grab the current id, but is there a convience method/helper to get the current IPublishedContent?

  • andrew shearer 409 posts 517 karma points
    Aug 17, 2013 @ 04:49
    andrew shearer
    0

    Ultimately, what I want to do is obtain the top level content node that the current page sits under.

    I want to do this by walking back up the content hierarchy i.e. IPublishedContent.AncestorOrSelf("myAlias")

     

    I know there is “ContentService.GetRootContent()” but that won't be accurate when theres multiple root nodes i.e. a multilingual site. I guess another option is to use GetRootContent() and then check for a certain descendent, but the performance is likely to be horrible.

  • andrew shearer 409 posts 517 karma points
    Aug 18, 2013 @ 07:26
    andrew shearer
    100

    my controller is a surface controller, so I ended using:

    SurfaceController.CurrentPage

    and this to find the homepage for the current IPublishContent:

    var currentHomePage = CurrentPage.AncestorOrSelf("HomePage");

     

    hope that helps someone else.

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies