繁体   English   中英

文本标签属性ASP.Net中的eval和anchor tag href

[英]eval and anchor tag href in a text label property ASP.Net

我一直在尝试让这些程序运行在许多不同的样本上,但是没有运气。

对我来说似乎还可以,但是我在这里想念的是什么?

<asp:Label ID="Label1" runat="server" Text="<%# String.Format("<a href=http://localhost/reportserver/Pages/ReportViewer.aspx?/temp&rs:Command=Render&id={0}>link</a>", Eval("ID")) %>" Width="100px" visible="true"></asp:Label>

谢谢

“没有运气”不是描述性错误。

<%#仅用于数据绑定表达式。 那么,您是否在代码隐藏中调用了Page.DataBind()或至少Label1.DataBind()

您也可以尝试

Text='<%= String.Format("<a href=http://localhost/reportserver/Pages/ReportViewer.aspx?/temp&rs:Command=Render&id={0}>link</a>", Eval("ID")) %>'

除此之外,为什么不只在代码隐藏中做这些事情,这样您就不会遇到这样的问题?

<asp:Label ID="Label1" runat="server" Text='<%# String.Format("<a href=http://localhost/reportserver/Pages/ReportViewer.aspx?/temp&rs:Command=Render&id={0}>link</a>", Eval("ID")) %>' Width="100px" visible="true"></asp:Label>

您不应该使用Text =“ something”。 您应该使用Text ='something'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM