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

asp:DataList 里 asp:HyperLink 的NavigateUrl的问题
<asp:DataList   runat= "server "   ID= "StuEWork "   CellPadding= "3 "   Width= "400 "   border= "2 "   BorderColor= "#FF0000 "   GridLines= "Horizontal ">
    <itemtemplate>

<asp:HyperLink   runat= "server "   Text= ' <%#   container.DataItem( "efile ")%> '   NavigateUrl= './resource/ '+ <%#   container.DataItem( "efile ")%> />
</itemtemplate>
    </asp:DataList>
这一句:
NavigateUrl= './resource/ '+ <%#   container.DataItem( "efile ")%> /> 出错了,就是关于NavigateUrl的要在前面加上 "./resource "文件夹,语法怎么写?


------解决方案--------------------
<asp:HyperLink runat= "server " Text= ' <%# container.DataItem( "efile ")%> ' NavigateUrl= '../resource/ '+ <%# container.DataItem( "efile ")%> />

------解决方案--------------------
<asp:HyperLink runat= "server " Text= ' <%# DataBinder.Eval(Container.DataItem, "efile ")%> ' NavigateUrl= ' <%# "./resource/ "+DataBinder.Eval(Container.DataItem, "efile ")%> ' />