如何在aspx页面中使用string.format和eval?

时间:2012-12-13 19:46:58

标签: asp.net eval

我的网页上有一个转发器,如下所示

<asp:Repeater runat="server" ID="AccountScrollRepeater" onitemdatabound="AccountRepeater_ItemDataBound">
<ItemTemplate>
    <tr class="primary-BL2" style="text-align:left">
        <td style="width:70px"><asp:Label runat="server" ID="AccountNoLabel" Text='<%# Eval("AccountNo") %>'></asp:Label></td>
        <td style="width:40px"><asp:HyperLink runat="server" ID="CustomerHyperLink" NavigateUrl="" Text='<%# Eval("CustId") %>' Enabled="false"></asp:HyperLink></td>
        ...
    </tr>
</ItemTemplate>

我想将CustomerHyperLink的NavigateUrl设置为以下表达式

string.Format(AppSetting.Instance.GetSearchDetailUrl(SearchTypeEnum.Customer), '<%# Eval("CustNo") %>');

我的问题是,不是在后面的代码中设置NavigateUrl,我如何将它放在aspx页面中?

1 个答案:

答案 0 :(得分:7)

我们走了

NavigateUrl ='<%# String.Format (AppSetting.Instance.GetSearchDetailUrl(SearchTypeEnum.Customer), Eval("intSMCID")) %>';
相关问题