Copied to clipboard

Flag this post as spam?

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


  • Martin 18 posts 73 karma points
    Jun 13, 2012 @ 14:03
    Martin
    0

    Razor: Dynamicnode and Macro with model. from elsewhere

    as title says i have a razor macro pulling information from another node ( dynamic), and on that node is a macro, that i need to pull ...

     

    @using umbraco.MacroEngines
    @inherits umbraco.MacroEngines.DynamicNodeContext
    
    @if (PageData.Count > 0){
            dynamic Library  = new DynamicNode(PageData[0]);

    and under that i can use 

    @Library.Fieldname

    to pull information from the page.

    However now i have this macro that pulls lots of fields from that page depending on dates.

    @RenderPage("/macroScripts/[Bibliotek]OpeningHours.cshtml")

    and in that macro i am using Model.Fieldname for information and checking of dates.

    Now, i get that Model in this case isnt correct as the pagedata thingy is something different.

    so basicly, how do i pull the model.fieldname from the renderpage script on this page?

    example of field in the renderpage macro

    if ((Model.visasFranPask<DateTime.Now.Date) && (Model.visasTillPask>DateTime.Now.Date)) {
            <h2>@Dictionary.EasterOpeningHours </h2>
            @Model.pask
        }

    /M

  • Martin 18 posts 73 karma points
    Jun 13, 2012 @ 15:54
    Martin
    0

    noone?

  • seanrock 99 posts 173 karma points
    Jul 16, 2013 @ 09:03
    seanrock
    0

    just a guess...

    ViewData["fieldname"]

Please Sign in or register to post replies

Write your reply to:

Draft