1
我在我的網頁中的中繼器像下面如何在aspx頁面中使用帶eval的string.format?
<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頁面?
爲什麼你不想這樣的'.aspx'如果它與代碼工作的背後? – Oded
如何從代碼中獲取超鏈接? – GLP
在中繼器'OnItemDataBound'事件處理程序中,使用'(HyperLink)AccountScrollRepeater.FindControl(「CustomerHyperLink」);'。 – Oded