NavigateUrl里的字符串和变量该如何拼接?
在一个DataList里放置了一个HyperLink控件。在NavigateUrl属性中,我要把 "~/news/ "字符串和 <%+#Eval( "newsURL ") %> 得到的字符串拼接起来,如果提取出来的newsURL字段为 "abc.htm "则NavigateUrl= "~/news/abc.htm "。原HTML代码如下,???处就是待填写的代码:
<asp:HyperLink ID= "HyperLink1 " runat= "server " Text= ' <%#Eval( "newsTitle ")%> ' Target= "_blank " NavigateUrl=???> </asp:HyperLink>
请大家帮个忙,谢谢~~~
------解决方案--------------------NavigateUrl= ' <%#Eval( "newsUrl ", "~/news/{0} ")%> '
------解决方案-------------------- <asp:HyperLink ID= "HyperLink1 " runat= "server " Text= ' <%#Eval( "newsTitle ")%> ' Target= "_blank " NavigateUrl= ' <%# "~/news/ " + Eval( "newsURL ").ToString()%> ' > </asp:HyperLink>