Copied to clipboard

Flag this post as spam?

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


  • Paul 6 posts 26 karma points
    Jan 20, 2010 @ 19:33
    Paul
    0

    Passing control values into a macro

    I have a page which has a paged list of subnodes.  This is created by calling an XSLT macro.  Now above this list I would like to have a droplist for the fields to sort by. 

    How do I put a drop list on the page that when changed will pass the value to the macro and re-render?

    I thought this must involve a postback. So I tried adding an asp.net droplist control with autopostback set to true. However when the page is reloaded, i cant get to the droplist value.

  • Dan 1285 posts 3917 karma points c-trib
    Jan 20, 2010 @ 21:04
    Dan
    0

    Hi Paul,

    I'm not sure how you're writing your select list, but if you can get it to post a variable/value to a particular page (try it as a querystring then you can see easily) then you should be able to grab that value from within the macro by doing something like this:

    <xsl:variable name="variablename">
            <xsl:choose>
                <!-- querystring value, if present -->
                <xsl:when test="string(umbraco.library:RequestQueryString('variablename
    ')) != ''">
                    <xsl:value-of select="string(umbraco.library:RequestQueryString('variablename
    '))" />
                </xsl:when>
                <!-- form field value, if present -->
                <xsl:when test="string(umbraco.library:RequestForm('variablename
    ')) != ''">
                    <xsl:value-of select="string(umbraco.library:RequestForm('variablename
    '))" />
                </xsl:when>
                <!-- no value -->
                <xsl:otherwise>
                    <xsl:value-of select="''"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

    Hope this helps...

  • Paul 6 posts 26 karma points
    Jan 21, 2010 @ 23:36
    Paul
    0

    thanks mate. I tried that. but nothing gets returned.  I wonder if its because the control has all that other stuff in the control name. Any idea of how to get at asp.net controls?

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jan 22, 2010 @ 00:26
    Thomas Höhler
    0

    Do you have a form tag with runat server? Then you get the postback and all the values submitted...

    Can I see the code of the control?

    My shot in the dark is that perhaps the binding to the onSelectedItemChanged of the dropdown isn't there...

     

Please Sign in or register to post replies

Write your reply to:

Draft