问题在ASP分配的声明价值:超链接。错误:这不是scriptlet而。将输出为纯文本 [英] problem assigning declarative values in asp:hyperlink. error: this is not scriptlet. will output as plain text

查看:159
本文介绍了问题在ASP分配的声明价值:超链接。错误:这不是scriptlet而。将输出为纯文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做到这一点:

<asp:HyperLink NavigateUrl='<%= WebContext.RootUrl %><%= WebContext.CurrentUser.UserName %>' runat="server" Text='<%= GetProfileImage(WebContext.CurrentUser.AccountId) %>'></asp:HyperLink> 

但我得到的错误:

But am getting the error:

这是不是scriptlet而。将输出
  纯文本。

this is not scriptlet. will output as plain text.

当我鼠标移到我的声明语句。

when I mouse over my declarative statements.

任何想法?谢谢你。

推荐答案

您可以使用数据绑定语法&LT;%#%&GT; 。只要确保你的超链接是无论是在数据绑定控件,如ListView项模板,或者你明确地调用的DataBind()从code-控制后面。

You can use data binding syntax <%# %>. Just be sure that your hyperlink is either in a databound control, such as a ListView item template, or that you explicitly call DataBind() on the control from code-behind.

这篇关于问题在ASP分配的声明价值:超链接。错误:这不是scriptlet而。将输出为纯文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆