【问题标题】:repeater ASP .NET databind to navigationURL转发器 ASP .NET 数据绑定到 navigationURL
【发布时间】:2012-10-18 12:43:33
【问题描述】:

我正在尝试通过超链接将 ID 绑定到已定义的导航 url。

<asp:HyperLink ID="HyperLink4" runat="server" 
    NavigateUrl='accounts_history.aspx?accountId=<%# DataBinder.Eval(Container.DataItem, "Id") %>'>Historiek</asp:HyperLink>

这是我的超链接。 &lt;%# DataBinder.Eval(Container.DataItem, "Id") %&gt; 部分有效,但使用此方法,超链接只会将其视为明文,从而产生以下链接:

accounts_history.aspx?accountId=<%# DataBinder.Eval(Container.DataItem, "Id") %>

这是什么原因造成的?

【问题讨论】:

    标签: asp.net databinder


    【解决方案1】:

    试试这个

    NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "Id", "accounts_history.aspx?accountId={0}") %>'
    

    http://msdn.microsoft.com/en-us/library/2d76z3ck.aspx

    您应该只在属性中放置数据绑定表达式。

    【讨论】:

      猜你喜欢
      • 2011-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-02
      • 1970-01-01
      • 1970-01-01
      • 2018-11-24
      • 1970-01-01
      相关资源
      最近更新 更多