Copied to clipboard
  • Yovav Gad 62 karma points
    Aug 09, 2010 @ 18:24
    Yovav Gad
    0

    How to add a property and apply it to a user control at all levels ?

    I've created a user control with a true/false property and set it up as a macro on my main template (master page)

    I want to be able to set that property to true of false from any page that inherit that template and pass it to the user control at the main template (master page)

    How can I receive the value and inject it to the property of my user control ?

  • Tom Fulton4391 karma points c-trib
    Aug 09, 2010 @ 18:37
    Tom Fulton
    0

    You can pass in the property value recursively by replacing the [#myProperty] with [$myProperty]

    This will have it find the value by recursing parent nodes and using the first node that has that property set.

    IE:

    <umbraco:Macro MyProperty="[$myPropertyAlias]" Alias="MyMacro" runat="server"></umbraco:Macro>

     

  • Sascha Wolter1095 karma points
    Aug 09, 2010 @ 18:40
    Sascha Wolter
    0

    Hi Yovav,

    have a look at the advanced parameter syntax here: http://umbraco.org/documentation/books/macro-parameters-syntax/advanced-parameter-syntax.

    Using recursive page values should be what you are looking for. When the .Net control is placed on the master page the actual value will be determined by first by the current page (if the value is set), otherwise by it's parent (if that value is set) and so forth.

    Hope that helps,
    Sascha

Please Sign in or register to post replies

Write your reply to:

Draft
Our.umbraco.org is the community mothership for Umbraco, the open source asp.net cms. With a friendly forum for all your questions, a comprehensive documentation and a ton of packages from the community.