【发布时间】:2015-04-21 12:26:21
【问题描述】:
我有一个内部带有 ASP.net 超链接字段的 DataGridView。我要做的不是根据条件显示某个超链接。我有确定是否应该隐藏超链接的 SQL,但我无法让它在超链接中工作。
我尝试了<asp:HyperLinkField....Visible="<%= Eval(Condition) %>" />,我的 SQL 查询中的条件是 True 或 False。
当然会抛出错误Cannot create an object of type 'System.Boolean' from its string representation '<%= Eval(Condition)%>' for the 'Visible' property。
所以我从Why will <%= %> expressions as property values on a server-controls lead to a compile errors? 和其他类似问题中理解了这一点。
我现在的问题是:解决方法是什么?如何根据我的情况显示或不显示超链接?
【问题讨论】:
标签: c# asp.net datagridview hyperlink webforms