Copied to clipboard

Flag this post as spam?

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


  • Steve 472 posts 1216 karma points
    Apr 22, 2016 @ 15:14
    Steve
    0

    Parameter from Doctype and Macro Not Accessable

    I've got a parameter "hideNav" in a razor that is used in a template created on the doctype that contains the parameter "hideNav" as a True/False dataType. I can't get it to even show me what it is outputting to the page (True/False, "1" or "0"). Doesn't matter wheater the box is checked or not.

    Here is my razor (part):

    var HideNav = (@Parameter.hideNav == "1") ? "hidden" : "";
        <p>@Parameter.hideNav</p>
        <ul class="nodeList @HideNav">
    

    I am trying to add the class "hidden" to the unorderd list tag.

  • Jules 276 posts 587 karma points
    Apr 23, 2016 @ 08:18
    Jules
    0

    How are you sending the parameter value to the macro?

  • Steve 472 posts 1216 karma points
    Apr 25, 2016 @ 12:53
    Steve
    0

    I guess that is my question Jules. I am not sure how to get it from the doctype to the macro. I've tried adding it the the umbraco macro tag in the template, as a blank parameter "hideNav=""" or even hideNave="someVariable" and then creating the someVariable in the cshtml :

    var someVariable = Model.HasValue("hideNav").Equals("1");
    
Please Sign in or register to post replies

Write your reply to:

Draft