Copied to clipboard

Flag this post as spam?

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


  • Harry Spyrou 212 posts 604 karma points
    Dec 13, 2017 @ 13:37
    Harry Spyrou
    0

    Same partial view but different content based on the page rendered

    Hello guys!

    So what I'm trying to do (and don't know if it works like this in Umbraco) is to have a certain partial view, with certain textboxes but let the content editor upload content that shows to a specific page only. E.g:

    Home page
        Partial View A
            textbox a - This is the home Page
    
    Styling Page
        Partial View A
            textbox a - This is the Styling Page
    

    So, different pages, Same partial view, content based on page.

    Basically I want to do something like Episerver does, where I have a block of code, but the content can be different each time. Kind of. Is there a way to do that in Umbraco? (FYI I don't know how to use Episerver, I just know what it does)

    Thanks in advance.

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Dec 14, 2017 @ 16:06
    Alex Skrypnyk
    100

    Hi Harry

    Use Html.Partial helper for rendering your partial view.

    And Umbraco.AssignedContentItem for accessing for current page data like that:

    Umbraco.AssignedContentItem.GetPropertyValue("propertyAlias")
    

    Have a look at https://our.umbraco.org/documentation/reference/querying/umbracohelper/

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft