为GridView中的删除的按钮添加确认的对话框

xiaoxiao2022-11-25  278

方法一、在前台加:在删除按钮的onclick事件中加入确认的JS函数即可 方法二、在后台加 protected void gvUrl_RowDataBound(object sender,GridViewRowEventArgs e) { ///为删除按钮添加确认对话框 ImageButton ibtDelete = (ImageButton)e.Row.FindControl("ibtDelete"); if(ibtDelete != null) { ibtDelete.Attributes.Add("onclick","return confirm('你确定要删除所选择的数据行吗?');"); } } 相关资源:Java 面经手册·小傅哥(公众号:bugstack虫洞栈).pdf
转载请注明原文地址: https://www.6miu.com/read-4979064.html

最新回复(0)