linkbutton用法咯

在ajax 中怎样在点击LinkButton 后弹出confirm确认框


LinkButton


C# code
protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) {  //添加删除确认 LinkButton linkbtn = (LinkButton)e.Row.FindControl("LinkButton2"); linkbtn.Attributes.Add("onclick", "return confirm('您确认要删除吗?')"); } }


LinkButton
只是简单的弹出了确认对话框,但是要怎么才能实现删除操作呢?




JScript code
 用JQURY $("#LinkButton1").live('click',function(){ if(confirm('要关要开?')) { } });




protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
  {
  if (e.Row.RowType == DataControlRowType.DataRow)
  {  
  LinkButton linkbtn = (LinkButton)e.Row.FindControl("LinkButton1");
  linkbtn.Attributes.Add("onclick", "return confirm('确认要删除吗?')");
  }
  }






protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
  {
  if (e.Row.RowType == DataControlRowType.DataRow)
  {   
  LinkButton linkbtn = (LinkButton)e.Row.FindControl("LinkButton1");
  linkbtn.Attributes.Add("onclick", "return confirm('确认要删除吗?')");
  }
  }


本篇文章来源于 www.phpzy.com 原文链接:http://www.phpzy.com/php/735006.html

你可能感兴趣的:(技术文章)