Reputation: 41
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.
Upvotes: 1
Views: 449
Reputation: 9424
Replace with this code:
<a href='NewsByTitle.aspx?title=<%#Server.UrlEncode( XPath("@title").ToString()) %>' ><%# XPath("@title") %></a>
Upvotes: 1