Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jul 01, 2011 @ 16:41
    Simon Dingley
    0

    Control Master Page Control Visibility with In-line Razor Macro

    I want to use an inline Razor Macro in a Master page to control the visibilty of a web control in the Master page template as follows:

    phHeaderPanel.Visible = @Model.showHeaderPanel == 1

    ...but this does not appear to be possible as I get a get an error stating:

    "The name 'phHeaderPanel' does not exist in the current context"

    Is this even possible?

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Jul 01, 2011 @ 16:44
    Sebastiaan Janssen
    1

    Razor does not live in the asp.net control lifecycle. It might be possible, but not without using a few tricks.

  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jul 01, 2011 @ 16:45
    Simon Dingley
    0

    OK thanks. Might find an alternative approach to what I am trying to do then.

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Jul 01, 2011 @ 16:53
    Sebastiaan Janssen
    0

    jQuery: hide() ? ;)

    Also have a look at this topic, it seems very similar: http://our.umbraco.org/forum/developers/razor/21722-Set-Razor-macro-parameters-in-code-behind

  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jul 01, 2011 @ 17:13
    Simon Dingley
    0

    Thanks, I've gone for uComponents uQuery to get the property from the current page and control the visibility of the web control.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies