日期:2014-05-18  浏览次数:20524 次

在dataformatstring中对网址中的中文进行编码的问题
<a   href=xx.aspx?id={0}> {0} </a>
其中   {0}代表一个中文字词
如果对第一{0}进行urlencode编码,应该如何写代码?

------解决方案--------------------
<a href= ' <% String.Format( "xx.aspx?id={0} ", Server.UrlEncoder(Eval( "id "))) %> ' runat= "server "> Server.UrlEncoder(Eval( "id ")) </a>

------解决方案--------------------
try ->

<itemtemplate>
<%# String.Format( " <a href=xx.aspx?id={0}> {0} </a> ", Server.UrlEncode(Eval( "id ").ToString())) %>
</itemtemplate>