beginner question: feeding a query string into an Xpath expression

X

xerj

I've worked out how to retrieve a parameter from a query string in a url
using Request.Querystring("whatever"). However, what I can't figure out is
how to feed this into an Xpath expression.

For instance, say I have an Xpath as follows:
food/fruit[@type='typeoffruit']. How do I programmatically alter the
'typeoffruit' attribute using the querystring in the url (example
whatever.aspx?fruit=banana via Request.Querystring or whatever command is
needed to achieved this? Via code render blocks?

TIA.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

I think that you are making it far more complicated than it is... Just
concatenate the strings:

"food/fruit[@type='" + Request.QueryString("fruit") + "']"

When you got it working you should validate the input first, though.
 
X

xerj

I think that you are making it far more complicated than it is

I sure was.

Thanks a plenty! Works now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top