[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1321
  • Last Modified:

Passing "&" through query string for DVWP query filter value

Hello,

I'm trying to configure a sharepoint 2007 dataview webpart to filter the list based on parameters passed through the URL.

This is all working, although I have come across a value in the list which has an "&" symbol in the text.

How do I pass this value through the URl so that sharepoint interprets it as part of the text rather than a seperator for the next variable?

I've seen other posts with this problem, and they used encode URL as the solution, although I'm not sure I can use that here as its a dataview webpart picking up the variable so I can't see how I'd get it to decode the URL.

Thanks
0
bedsingar
Asked:
bedsingar
1 Solution
 
Derek JensenCommented:
encodeURI should work regardless, as & is an ASCII encoding standard. If sharepoint doesn't know how to interpret this, then it's not a very good program. But, I'm fairly certain it does. :-)
0
 
hieloCommented:
If you are coding an HREF url, assuming you want to pass "company=AT&T" as well as "category=telephone", then you should code as follows:

<a href="page.aspx?company=AT%26T&category=telephone">...</a>

The %26 represents the "&" in "AT&T" and is interpreted as actual text.  In case you are wondering where the %26 came from, refer to:

http://www.asciitable.com/

Under the "Chr" column look for the "&" symbol.  Then locate its numeric value under the "Hx" column and prefix that numeric value with a percent symbol.  The same rationale applies for other special url symbols (/, =, ?, etc).
0
 
bedsingarAuthor Commented:
%26 worked perfectly without need for any modification to the sharepoint list / data view.

For info I also tried the &amp ... this didn't work on the sharepoint list.

Thanks for your help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now