如何使用客户端函数「OnClientClicking」传递bind或eval参数?

时间:2015-06-23 05:16:28

标签: asp.net

<asp:LinkButton ID="lnbSeach" CssClass="BtnSearch" runat="server" Text="Seach" OnClientClick='window.open("ItemSeach.aspx?ItemID=123", "_blank")' />

如何替换123更改为'<%# Eval("FileCode")) %>'

1 个答案:

答案 0 :(得分:0)

使用以下代码:

<asp:LinkButton ID="lnbSeach" CssClass="BtnSearch" runat="server" Text="Seach" OnClientClick='window.open("ItemSeach.aspx?ItemID="+ Eval("FileCode") + "", "_blank")' />

  <asp:LinkButton ID="lnbSeach" CssClass="BtnSearch" runat="server" Text="Seach" OnClientClick='<%# Eval("FileCode","window.open('ItemSeach.aspx?ItemID={0}', '_blank') %>' />