写在这个事件里
protected void gridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton db = (LinkButton)e.Row.Cells[0].Controls[2];//找到你的删除按钮
db.OnClientClick = string.Format("return confirm('确实要删除该记录么?');");
}
}
可以用 linkbutton 的 OnClientClick="return confirm('您确定删除吗?');"