方法一:

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('您真的要删除此行吗?')");
    }

相关文章:

  • 2022-12-23
  • 2021-10-18
  • 2021-09-30
  • 2021-07-12
  • 2022-12-23
  • 2022-02-10
  • 2021-12-23
  • 2021-08-17
猜你喜欢
  • 2022-03-06
  • 2021-12-03
  • 2022-02-06
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案