在daragrid中加了delete列,但是处理事件始终不响应,请各位帮帮忙!
而且我在InitializeComponent中添加了处理事件
private void InitializeComponent()
{
     this.datagriddeleteaccount.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.datagriddeleteaccount_DeleteCommand);
this.Load += new System.EventHandler(this.Page_Load);
}

解决方案 »

  1.   

    从你写的看并没有什么错误,将你private void datagriddeleteaccount_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {

    }
    部分的代吧列出来看看好吗?
      

  2.   

    为什么你给你的DataGrid控件取了个"datagriddeleteaccount"这么长的名字?
      

  3.   

    String connectionString="Data Source=localhost;Initial Catalog=advertising;uid=sa;pwd='';";
    SqlConnection myConnection = new SqlConnection(connectionString);
    string deleteCmd = "DELETE from Account where id = "+e.Item.Cells[1];
    SqlCommand mycommand = new SqlCommand(deleteCmd,myConnection);
    mycommand.Connection.Open();
    mycommand.ExecuteNonQuery();
    mycommand.Connection.Close();
    databind();
      

  4.   

    不行的话可以写在ItemCommand里面
      

  5.   

    先将事件代码改为
    Response.Write("<script language =javascript > alert('运行!');</script>")
    看能不能调用能的话用SqlSever的事件探查器查看Sql 的语句是否正确运行
      

  6.   

    我试过了 enterzhuang(老庄) 的方法,好像根本就不调用
      

  7.   

    用了Sword_liao(Sword_liao) 的方法也不行,我的程序我都看了很多回了都觉得没有问题,看来我是不是应该重新建一个webform再写一遍了