Copied to clipboard

Flag this post as spam?

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


  • Stephen Davidson 216 posts 392 karma points
    Oct 20, 2014 @ 16:28
    Stephen Davidson
    0

    Use content picker in PartialViewMacroPage

    Keep getting an error loading partial view in the following code. I have added the praameters to the Macro but I know i'm doing somehitng stupid below.

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @*
    Macro to display a gallery from a media folder. Add the below parameter to the macro
    and use it to point the macro at a specific media folder to display it's content as
    a simple list.
    
    Macro Parameters To Create, for this macro to work:
    Alias:demoPageID     Name:Demo page ID    Type:Content Picker
    *@
    @* Get the demo page as a dynamic node *@
    
    
    @if (Model.MacroParameters["demoPageID"] != null)
    {
         @* Get the demo page  *@
         var demoPage = Umbraco.Content(Model.MacroParameters["demoPageID"]);
    
            <div>
                <a class="button" href="@demoPage.Url">Experience compliance made simple:</br>
            CLICK TO TAKE A LIVE DEMONSTRATION <i class="fa fa-external-link-square"></i></a>
            </div>
    
    
    }
  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Oct 20, 2014 @ 17:32
    Dennis Aaen
    100

    Hi Stephen,

    I have tried you code, and find what your problem is, the thing that gives your problem is that you are closing your break tag wrong. </br> instead of <br />

    I have updated the code below.

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @*
    Macro to display a gallery from a media folder. Add the below parameter to the macro
    and use it to point the macro at a specific media folder to display it's content as
    a simple list.

    Macro Parameters To Create, for this macro to work:
    Alias:demoPageID     Name:Demo page ID    Type:Content Picker
    *@
    @* Get the demo page as a dynamic node *@


    @if (Model.MacroParameters["demoPageID"] != null)
    {
         @* Get the demo page  *@
         var demoPage = Umbraco.Content(Model.MacroParameters["demoPageID"]);

           <div>
                <a class="button" href="@demoPage.Url">Experience compliance made simple<br />
            CLICK TO TAKE A LIVE DEMONSTRATION <i class="fa fa-external-link-square"></i></a>
            </div>
    }

    Hope this helps,

    /Dennis

  • Stephen Davidson 216 posts 392 karma points
    Oct 20, 2014 @ 18:18
    Stephen Davidson
    0

    Darn! Knew it would be something simple...thanks for taking the time to look.

Please Sign in or register to post replies

Write your reply to:

Draft