ASP.NET2.0下为GridView添加服务器端删除确认!
作者:Eve Cole
更新时间:2009-06-30 17:02:30
protected void GridView1_RowDataBound(对象发送者,GridViewRowEventArgs e)
{
//在服务器端添加删除确认
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton btnDelete = (LinkButton)e.Row.FindControl("LinkButton1");
btnDelete.Attributes.Add("onclick", "javascript:return " +"confirm('您确定要删除这条记录吗" +DataBinder.Eval(e.Row.DataItem, "编号") + "')" );
}
}