asp.net

.net中repeater删除前弹窗询问及删除

2022-04-23

前端代码:

<asp:LinkButton ID="delLinkButton" runat="server" OnClientClick='return confirm("确定删除?")'
        CommandName="del" CommandArgument='<%# Eval("ID") %>'>删 除</asp:LinkButton>


后端代码:

protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
        if (e.CommandName == "del")
        {
            //删除的方法
        }
}