x First time here? Check out the FAQ
  • Avatar41posts62karma

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

    Yovav Gad started this topic August 9, 2010 @ 06:24, Go directly to the topic solution

    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 Fulton posted this reply August 9, 2010 @ 06:37

    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>

     


  • Avatar615posts1089karma
    Comment with ID: 42412
    Sascha Wolter posted this reply August 9, 2010 @ 06:40

    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 login or Sign up To post replies