default querystring Options
Jasko
Posted: Wednesday, February 06, 2008 11:29:29 AM
Rank: Devotee

Joined: 12/11/2006
Posts: 47
Hi,

I am just wondering if it is possible to set a default querystring on a certain page?

Let's say I have this link www.example.com/products.aspx?id=1087 - How can I ensure that I always start on this querystring instead of www.example.com/products.aspx. ??


/Jan
seb
Posted: Wednesday, February 06, 2008 11:43:17 AM

Rank: Devotee

Joined: 1/10/2008
Posts: 75
Location: London
What are you looking to achieve exactly ? Do you want product ID=1087 to be the default ?
In that case, you could just check when the page is loading that if Request["id"] == null then use id = 1087

Does it helps ?

seb

http://www.be-k.net
Jasko
Posted: Wednesday, February 06, 2008 11:52:06 AM
Rank: Devotee

Joined: 12/11/2006
Posts: 47
Hi Sebastien,

I get the idea, but I am not sure how to do it in the XSLT. Do you have any advice on that?

/Jan
seb
Posted: Wednesday, February 06, 2008 2:49:41 PM

Rank: Devotee

Joined: 1/10/2008
Posts: 75
Location: London
Ah sorry I didn't see your were referring to XSLT.

There might be a more straightforward way but I suppose you could use this example:
http://umbraco.org/documentation/books/extending-xslt-with-c-or-javascript/extending-using-c-sharp
">http://
http://umbraco.org/documentation/books/extending-xslt-with-c-or-javascript/extending-using-c-sharp

where you can implement some server side code to read your request variable and default it to your needs.


seb

http://www.be-k.net
drobar
Posted: Wednesday, February 06, 2008 2:51:38 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,698
Location: KY, USA
You could do something like this to get the querystring value and set it to a default value if it doesn't exist...

Code:

<xsl:variable name="ProductId">
    <xsl:choose>
        <!-- set default value -->
        <xsl:when test="string(umbraco.library:RequestQueryString('id')) = ''">1087</xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="umbraco.library:RequestQueryString('id')"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>


cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.