Copied to clipboard

Flag this post as spam?

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


  • Daniel McAteer 16 posts 136 karma points
    Apr 21, 2017 @ 13:35
    Daniel McAteer
    0

    The name 'Parameter' does not exist in the current context

    Hey,

    Using a fresh install of Umbraco (v7.5.6) and getting a weird issue when trying to use a parameterised macro inside the context of a RTE field.

    The macro itself works fine after I've removed the @Parameter.test but whenever that gets included, it just breaks. I've done the same kind of thing before on other sites, so a bit confused as to what the cause might be.

    If it helps I can post the stacktrace up from the error message? or if there's any other useful info I can provide, just let me know.

    Kind Regards, Daniel

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 21, 2017 @ 13:38
    Alex Skrypnyk
    0

    Hi Daniel

    Are you using dynamics params?

    Can you share please a wrong code?

    Thanks,

    Alex

  • Daniel McAteer 16 posts 136 karma points
    Apr 21, 2017 @ 13:42
    Daniel McAteer
    0

    Hi Alex,

    I have a macro with a partial view, the partial view throws the error even on the most barebones example, such as:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @Html.Raw(Parameter.vidurl)
    

    Was it this partial view code you meant?

    Kind Regards, Daniel

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 21, 2017 @ 13:47
    Alex Skrypnyk
    100

    Daniel

    Try this code please:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @Html.Raw(Model.MacroParameters["vidurl"])
    

    Parameter - is removed.

    Hope this is what you want.

    Thanks,

    Alex

  • Daniel McAteer 16 posts 136 karma points
    Apr 21, 2017 @ 13:52
    Daniel McAteer
    0

    Worked like a charm! :D Thanks very much Alex! :)

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 21, 2017 @ 13:53
    Alex Skrypnyk
    0

    You are welcome, Daniel!

    Glad to help you. Have a nice evening

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft