문제

I am trying to encode the url using HttpUtility.UrlEncode, but not able to make it work. HyperLink control is in the template field of gridview.

Can anyone please help me out with this?

I have tried changing the target application and by adding System.Web reference to project but still not able to Encode the url.

Please guide me.

Following is part of my code:-

<asp:HyperLink ID="lnkDetailsPage" runat="server" NavigateUrl='<%# string.Format("~/YellowPages/YellowDetailView.aspx?CustomerId={0}",HttpUtility.UrlEncode(Eval("CustomerId").ToString())) %>'></asp:HyperLink>

Thanks in advance.

도움이 되었습니까?

해결책

Use Server.UrlEncode() instead. Why do you need to encode your CustomerID?!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top