1

I want to send title of news to some other page through query string. My title is dynamic so it may contain '&' or other special characters. So I tried this

  <a href="NewsByTitle.aspx?title=<%#HttpServerUtility.HtmlEncode(XPath("title"))%>"

But I am getting error "The best overloaded method match for 'System.Web.HttpServerUtility.HtmlEncode(string)' has some invalid arguments" Please help me.

1 Answer 1

1

Replace with this code:

<a href='NewsByTitle.aspx?title=<%#Server.UrlEncode( XPath("@title").ToString()) %>' ><%# XPath("@title") %></a>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.