Copied to clipboard

Flag this post as spam?

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


  • Preetee Gangoosirdar 56 posts 257 karma points
    Sep 21, 2016 @ 11:19
    Preetee Gangoosirdar
    0

    How to insert a javascript variable as Macro Parameter in a razor script

    Hi Everyone,

    Grateful if someone can help me out on this issue.

    I need to pass a session storage value as parameter in a razor script in a template

    In my template i call my macro script that allows me to pass this dynamic parameter via a session storage variable

    <umbraco:Macro offerName= sessionStorage.getItem('offerName')> Alias="MoreOffer" runat="server"/>
    

    Thank you for your help and response.

    Good day

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 21, 2016 @ 11:42
    Alex Skrypnyk
    0

    Hi Preetee,

    Nice question.

    You can't call js method - sessionStorage.getItem('offerName') inside serverside tag. This tag is working on page load event, sessionStorage.getItem('offerName') working inside borwser.

    <umbraco:Macro Alias="MoreOffer" runat="server"/>
    

    Only way is to pass data from browser to server.

    Thanks,

    Alex

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 22, 2016 @ 20:08
    Alex Skrypnyk
    100

    Hi Preetee,

    Do you need some help?

    Thanks

  • Preetee Gangoosirdar 56 posts 257 karma points
    Nov 15, 2016 @ 12:56
    Preetee Gangoosirdar
    0

    Hi Alex,

    Am sorry for the late reply as am back after a long time, i got it sorted out. Thank you very much ! thank you

Please Sign in or register to post replies

Write your reply to:

Draft