62,041
社区成员
发帖
与我相关
我的任务
分享
onclick='MySum(<%# Eval("Id") %>)'
是调用一个JS方法的
onclick="MySum(<%# Eval("Id") %>)"
没解释出来,怎么办,搞了半天了 onclick='<%#clientFunction(Eval("Number").ToString()) %>'
后台cs
public string clientFunction(string Number)
{
return "t('" + Number+ "')";
}
<asp:listview ID="lsView" runat="server" DataSourceID="SqlDataSource1" ItemPlaceholderID="ItemPlaceHolder">
<LayoutTemplate>
<table border="2">
<thead>
<tr>
<th>ProductID</th>
<th>ProductName</th>
<th>UnitPrice</th>
</tr>
</thead>
<tbody>
<asp:PlaceHolder runat ="server" ID="ItemPlaceHolder"></asp:PlaceHolder>
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td><%# Eval("Number")%></td>
<td><%# Eval("Name")%></td>
<td><input type="button" id="btnal" onclick='t(<%# Eval("Number") %>)' value="点击我" /></td>
</tr>
</ItemTemplate>
</asp:listview>
你可以看看这个,这个就没有问题啊
<asp:listview ID="lsView" runat="server" DataSourceID="SqlDataSource1" ItemPlaceholderID="ItemPlaceHolder">
<LayoutTemplate>
<table border="2">
<thead>
<tr>
<th>ProductID</th>
<th>ProductName</th>
<th>UnitPrice</th>
</tr>
</thead>
<tbody>
<asp:PlaceHolder runat ="server" ID="ItemPlaceHolder"></asp:PlaceHolder>
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td><%# Eval("Number")%></td>
<td><%# Eval("Name")%></td>
<td><input type="button" id="btnal" onclick='t(<%# Eval("Number") %>)' value="点击我" /></td>
</tr>
</ItemTemplate>
</asp:listview>