方法一、在前台加:在删除按钮的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