A: OnClientClick='<%#String.Format("return jsf(\"{0}\",\"{1}\")",Eval("domain"),Eval("siteid")) %>'>
B: OnClientClick= '<%#Eval("domain","return jsf(\"{0}\")") %>'
C: OnClientClick='<%# "javascript:return jsf(" + Eval("id") + ");" %>'
domain、siteid、id都是外层数据集中的列名,jsf为javascript函数名。
注意学会用 String.Format 不要去 ++++
注意 " ' 转义,特别 js 与 C# 混用
==========================================================================================================================
下面是我自己做项目时的写法,可以成功!
<ItemTemplate>
<input type="checkbox" data="<%# Eval("ID") %>" name="GridItemsList" onclick="BRC.ChkBox.CheckGroup(this, 'GridItemsList_chkAll')" />
</ItemTemplate>
<HeaderStyle Width="48px" />
</asp:TemplateColumn>
<asp:BoundColumn DataField="ID" HeaderText="编号" Visible="False">
<HeaderStyle Width="30px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="DossierName" HeaderText="卷宗名称" />
<asp:BoundColumn DataField="StateTypeValue" HeaderText="状态" SortExpression="StateTypeValue" />
<asp:BoundColumn DataField="Remark" HeaderText="备注" SortExpression="Remark" />
<asp:TemplateColumn HeaderText="编辑">
<ItemStyle Wrap="False" HorizontalAlign="Center" Width="80px" />
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/App_Themes/Default/images/edit.gif"
AlternateText="编辑" OnClientClick='<%# String.Format("BRC.Dialog.ControlBtn(\"{0}\",\"../Dialogs/DossierEdit.aspx?Mode=Edit&amp;Id={1}\",600,200);return false;",btnRefresh.ClientID,Eval("id"))%>' />
&nbsp;
<asp:ImageButton ID="btn_Delete_Confirm" runat="server" ImageUrl="~/App_Themes/Default/images/del.gif"
AlternateText="删除" CommandName="Delete" CommandArgument='<%# Bind("Id") %>' OnClientClick="return confirm('确认要删除此行信息吗?')" />
<asp:Button runat="server" ID="btn_Delete" CommandName="Delete" CssClass="Invisible" />