Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi everyone,
Is it possible to pass a session variable into a macro as a parameter?
Thanks
Simon
Something like this should work as long as you have added the extra parameter on the macro in Umbraco:
<umbraco:Macro ID="Macro2" Test="<%Session["myVariable"].ToString(); %>" runat="server">
</umbraco:Macro>
Alterntatively you can also get fields from the node that is rendering if you do something like this:
<umbraco:Macro ID="Macro2" ToEmail="#[email]" runat="server">
So in this example I have an Event master page and an Event macro which has an extra parameter called ToEmail and as the event node is being rendered the Umbraco checks the node for a field called 'email' and passes it into the macro.
Hello,
Does not work.
Parser Error Message: Server tags cannot contain <% ... %> constructs.
Anybody has a suggestion how to pass a session variable into an umbraco macro?
TIA,
F
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Session variable in macro
Hi everyone,
Is it possible to pass a session variable into a macro as a parameter?
Thanks
Simon
Something like this should work as long as you have added the extra parameter on the macro in Umbraco:
<umbraco:Macro ID="Macro2" Test="<%Session["myVariable"].ToString(); %>" runat="server">
</umbraco:Macro>
Alterntatively you can also get fields from the node that is rendering if you do something like this:
<umbraco:Macro ID="Macro2" ToEmail="#[email]" runat="server">
</umbraco:Macro>
So in this example I have an Event master page and an Event macro which has an extra parameter called ToEmail and as the event node is being rendered the Umbraco checks the node for a field called 'email' and passes it into the macro.
Hello,
<umbraco:Macro ID="Macro2" Test="<%Session["myVariable"].ToString(); %>" runat="server">
</umbraco:Macro>
Does not work.
Parser Error Message: Server tags cannot contain <% ... %> constructs.
Anybody has a suggestion how to pass a session variable into an umbraco macro?
TIA,
F
is working on a reply...