Copied to clipboard

Flag this post as spam?

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


  • Mark Johnston 59 posts 111 karma points
    May 31, 2011 @ 14:21
    Mark Johnston
    0

    Getting value for macros using razor

        <umbraco:Macro Subject="Website Enquiry Form" YourEmail="@{Model.contactEmailAddress}" Alias="gdg.ContactForm" runat="server"></umbraco:Macro

    What would be the best way to fill the "YourEmail" value, the way I am trying using razor does not work when written into an Umbraco template.

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    May 31, 2011 @ 14:31
    Sebastiaan Janssen
    0

    You don't need to pass it in as a macro parameter, in your contactform Razor script, just use @Model.contactEmailAddress to get to that value.

  • Mark Johnston 59 posts 111 karma points
    May 31, 2011 @ 14:43
    Mark Johnston
    0

    The contact form is actually a plain asp.net user control. I was hoping I could do the heavy lifting of grabbing that value to pass to the user control rather than the deal with it in the user control.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    May 31, 2011 @ 14:46
    Jeroen Breuer
    1

    In that case you can probably use this:

    YourEmail="[#contactEmailAddress]" //only on current page

    or this

    YourEmail="[$contactEmailAddress]" //recursive value

    See this wiki for more info: http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters/advanced-macro-parameter-syntax

    Jeroen

  • Mark Johnston 59 posts 111 karma points
    May 31, 2011 @ 15:04
    Mark Johnston
    0

    Perfect with the recursive one. Thankyou very much. Learning a little more each day with the help of you guys.

Please Sign in or register to post replies

Write your reply to:

Draft