Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将超链接的文本值设置为数据绑定 url 字符串中的页面或图像名称。就像是:
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("attachUrl")%>' Text="<%# System.IO.Path.GetFileName(Eval("attachUrl"))%>"></asp:HyperLink>
NavigateURL 有效,但文本无效。
那是因为"在Eval方法中添加时会破坏字符串。在外部文本上使用撇号,以便您可以对方法使用双引号,Eval即
"
Eval
Text='<%# System.IO.Path.GetFileName(Eval("attachUrl").ToString())%>'