Copied to clipboard

Flag this post as spam?

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


  • Ashton Alexander 3 posts 73 karma points
    Feb 25, 2016 @ 22:10
    Ashton Alexander
    0

    Need to pass dynamic model, or call controller method in Partial View Macro

    Hi everyone,

    Umbraco 7.3.4

    Here's my Partial View Macro code - description of problem below:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    
    @{
     var newLowestAPR = "1.50%"; //needs to be dynamic
     var usedLowestAPR = "1.75%";
    }
    
    <ul class="featured-rates">
        <li>
            <h2><span>New Vehicle APR As Low As:</span></h2>
            <h2>@newLowestAPR</h2>
        </li>
        <li>
            <h2><span>Used Vehicle APR As Low As:</span></h2>
            <h2>@usedLowestAPR</h2>
        </li>
    </ul>
    

    Currently the APRs that are set have hardcoded values. I have the values I need within a backoffice controller that returns a list.

    I'd ideally hit this controller method and pass the list to my view, and update the view with that data. //I've commented the variables above with what is static that should be dynamic.

    My question is, what is the best route to go for getting my data?

    Should I be attempting to access the backoffice controller method? I've read into surface controllers, but haven't had much luck. Even if I could simply read data from my umbraco database table, that would work.

    Any help on this, or point outs in the correct direction would be extremely helpful.

Please Sign in or register to post replies

Write your reply to:

Draft