Copied to clipboard

Flag this post as spam?

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


  • bev0 39 posts 59 karma points
    Jan 30, 2010 @ 00:59
    bev0
    0

    how to access URL querystring inside a macro

    If i have a macro like this... <umbraco:Macro customerID="" Alias="bev0Link" runat="server"></umbraco:Macro>

    i can get the value for customerID by pull it from the URL querystring like this: <%=request.querystring("cid")%>

    but somehow the macro does not like it, i try customerID='<%=request.querystring("cid")%>' and customerID="<%=request.querystring('cid')%>" with no success. what am i missing ?

    please help

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Jan 30, 2010 @ 02:22
    Chriztian Steinmeier
    0

    Hi bev0 (!)

    You can use the bracket syntax to send a value from QueryString into your macro - like this:

    <umbraco:Macro customerID="[@cid]" Alias="bev0Link" runat="server"></umbraco:Macro>

    This page has more info on this 'trick' : advanced-macro-parameter-syntax

    /Chriztian

  • Stephan Lonntorp 195 posts 212 karma points
    Jan 30, 2010 @ 10:51
    Stephan Lonntorp
    0

    If you're in xslt, you could use:

    <xsl:value-of select="umbraco.library:RequestQueryString('MyQueryStringParameter')" />

    or:

    <xsl:value-of select="umbraco.library:RequestForm('MyFormParameter')" />

Please Sign in or register to post replies

Write your reply to:

Draft