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 6182 posts 24284 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 6182 posts 24284 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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies