if (e.Row.RowType == DataControlRowType.Pager) { Button btn = (Button)(e.Row.FindControl("btnDel")); if (btn != null) { btn.Attributes.Add("onclick", "return confirm('确定删除吗?')"); } } 转载于:https://www.cnblogs.com/wbcms/archive/2008/02/03/1063961.html