Copied to clipboard

Flag this post as spam?

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


  • Nguyen Dung Tri 106 posts 606 karma points
    Aug 04, 2016 @ 02:44
    Nguyen Dung Tri
    0

    How to add a partial view to content page?

    Hello,

    I have create a partial view and try to add it to a content page. But it just show a code inside the content page. How should I do to add my partial view to the content page?

    enter image description here

    enter image description here

  • Sabin Regmi 13 posts 93 karma points
    Aug 04, 2016 @ 05:05
    Sabin Regmi
    0

    Hi Nguyen, You can just call your partial view as

     @{
    
            Html.RenderPartial("MemberLogin");
    
      }
    

    If you want to pass model to partial view,

       @{
    
            Html.RenderPartial("MemberLogin", new Model());
    
      }
    
  • Nguyen Dung Tri 106 posts 606 karma points
    Aug 04, 2016 @ 06:24
    Nguyen Dung Tri
    0

    Hi Sabin,

    Please read my question again. I just want to show my partial view inside login page which created from Content pane. The Login page created under Home page with type of "Landing Page".

    Because of Landing Page doesn't allow to enter c# tag like @Html, so I cannot include my partial view into the Landing Page. That why I ask you to help me to find a way to include my partial view into contain page.

    enter image description here

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 04, 2016 @ 07:17
    Dennis Aaen
    102

    Hi Nguyen,

    If you want to add the partial view to a page using the backoffice, and not directly in to a template, then you can add the partial view in a rich text editor.

    But to be able to do this you need to use a Partial macro file https://our.umbraco.org/documentation/reference/templating/macros/partial-view-macros/ which are located under the developer section.

    If you dont have the insert macro on the rich text editor

    enter image description here

    If you donĀ“t see the option right now then you can configure which option that should be possible in the rich text editor.

    enter image description here

    Since you are using the grid layout, then you also have the possibility to add a macro into the grid.

    Try to see this documentation https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Grid-Layout/grid-editors

    What you just need to ensure is that the macro are allow to be insert into the grid or the rich text editor.

    enter image description here

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft