GridView中点击删除弹出JS提示信息
时间:2011-04-13 来源:悟生慧
方法一:
protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lbtnDelete = (LinkButton)e.Row.FindControl("ibtnDelete");
lbtnDelete.Attributes.Add("onclick", "return confirm('确认要删除此门店信息吗?')");
}
}
方法二:
protected void DetailsView1_DataBound(object sender, EventArgs e){
//获得DetailsView1里的Button1按钮
Button bbbb = this.DetailsView1.FindControl("Button1") as Button;
//重写onclick事件
bbbb.Attributes.Add("onclick", "return confirm('您真的要删除此行吗?')");
}
相关阅读 更多 +