thyros
asked on
Server.UrlEncode an XPath Value
I'm using an asp:XmlDataSource element with an asp:Repeater and the following XPath element works fine, but I need to know how to Server.UrlEncode the output value:
For example if the value was 'Sony T100 Digital Camera' I want to build an output url like this:
<a href="http://www.example.com/-Sony+T100+Digital+Camera">Sony T100 Digital Camera</a>
When I tried to use something like the following, it gives a server exception error:
Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.HttpServerUtil ity.UrlEnc ode(string )' has some invalid arguments
Using inline code, how can I get the XPath value of 'title' to be url encoded?
<%#XPath("title") %>
For example if the value was 'Sony T100 Digital Camera' I want to build an output url like this:
<a href="http://www.example.com/-Sony+T100+Digital+Camera">Sony T100 Digital Camera</a>
When I tried to use something like the following, it gives a server exception error:
<a href="http://www.example.com/-<%=Server.UrlEncode(XPath("url")) %>"><%#XPath("title") %></a>
Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.HttpServerUtil
Using inline code, how can I get the XPath value of 'title' to be url encoded?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.