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.
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>
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?
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.
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:
Hope this helps...
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?
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...
is working on a reply...