获取PagerTemplate内的控件 if (e.Row.RowType == DataControlRowType.Pager) { Button btn = (Button)(e.Row.FindControl("btnDel")); if (btn != null) { btn.Attributes.Add("onclick", "return confirm('确定删除吗?')"); } }