加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 在asp:超链接中分配声明值的问题 错误:这不是scrip

发布时间:2020-12-16 00:42:11 所属栏目:asp.Net 来源:网络整理
导读:我想这样做: asp:HyperLink NavigateUrl='%= WebContext.RootUrl %%= WebContext.CurrentUser.UserName %' runat="server" Text='%= GetProfileImage(WebContext.CurrentUser.AccountId) %'/asp:HyperLink 但是我收到错误: this is not scriptlet. will ou
我想这样做:
<asp:HyperLink NavigateUrl='<%= WebContext.RootUrl %><%= WebContext.CurrentUser.UserName %>' runat="server" Text='<%= GetProfileImage(WebContext.CurrentUser.AccountId) %>'></asp:HyperLink>

但是我收到错误:

this is not scriptlet. will output as
plain text.

当我把鼠标放在我的声明性语句上。

有任何想法吗?谢谢。

解决方法

您可以使用数据绑定语法<%#%&gt ;.只要确保您的超链接是在数据绑定控件中,例如ListView项目模板,或者从代码隐藏中显式调用控件上的DataBind()。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读