我有Repeater control
这样的;
<asp:Repeater ID="repeaterCategoryList" runat="server"
onitemcommand="repeaterCategoryList_ItemCommand">
<ItemTemplate>
<td class="center">
<asp:Button ID="buttonDelete" runat="server" CssClass="btn btn-primary" CommandName="Delete" Text="Delete"
CommandArgument='<%# Eval("CategoryId") %>'/>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
我的页面后面的代码如下所示;
protected void repeaterCategoryList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
//my server side logic here
}
}
我在 .aspx 文件中的 javascript 代码如下所示:
<script>
$(function () {
$('#buttonDelete').live('click', function (e) {
e.preventDefault();
$.alert({
type: 'confirm'
, title: 'Alert'
, text: '<p>Are you sure, you want to delete this category</p>'
, callback: function () {
// call server side here
}
});
});
});
</script>
如何在我的 javascrpt 中调用中继器删除命令逻辑?有没有其他方法可以做到这一点?