You will need an XSLT extension, (or custom function) to perform the following logic:
Pass the 'key' and 'replacementValue' to a function.
Copy the QueryString object to a NameValueCollection
Check if the NameValueCollection has the 'key'. If so, then replace the current value with the 'replacementValue'.
Then convert the NameValueCollection back to querystring type of String.
This is just pseudo-code, as I don't have time to provide a full function/method.
You are in luck with a few things... I have written a couple of blog posts about how to handle NameValueCollections.
string manipulation - if exists ..
hi guys ..
i need to check a string (my querystring) for a word and if its there i need to replace that + its value with a new value ..
Example:
http://test.com?page=1&topx=25&country=denmark&area=jutland
i extract the querystring so i get:
page=1&topx=25&country=denmark&area=jutland
then its here i need to check if ex 'area' exists - and if it comes back true - then i need to replace its value with a new value ...
so ill end up with the result:
page=1&topx=25&country=denmark&area=fyn
must be dynamic so i can check which parameter i want .. :-)
thank .. :-)
You can request individual url paramters via http://our.umbraco.org/wiki/reference/umbracolibrary/requestquerystring and replace with http://our.umbraco.org/wiki/reference/umbracolibrary/replace. ; That should do what you want
Dan
and if I dont know which parameters will be in my querystring or what position they will be at? :-)
Position or a querystring param doesn't matter, and if you don't know the parameter's name, hmm, that'll be pretty hard to deal with it!
If you need the names & values of all querystring params, write a small xslt extension that gets the querystring from the current request.
Cheers,
/Dirk
Hi Jonas,
You will need an XSLT extension, (or custom function) to perform the following logic:
This is just pseudo-code, as I don't have time to provide a full function/method.
You are in luck with a few things... I have written a couple of blog posts about how to handle NameValueCollections.
Making Request.QueryString writable (by clone/copy)
How to convert NameValueCollection to a (Query) String
Good luck!
Cheers, Lee.
is working on a reply...