我把datatable 的数据 用 gridview 显示。。 同时加了一个" 删除"按钮
当我点击 “删除“按钮时就会出现这个情况,                 
                                                                GridView“GridView1”激发了未处理的事件“RowDeleting”。 
怎么解决呢。我是要 把这一行的数据给删除掉。?      

解决方案 »

  1.   

    GridView“GridView1”激发了未处理的事件“RowDeleting” 
    <1>GridView“GridView1”激发了未处理的事件“RowDeleting” 异常详细信息: System.Web.HttpException: GridView“GridView1”激发了未处理的事件“RowDeleting”。 原因分析: 在GridView1的事件中,即删除的确认对话框,因此,当你单击【删除】按钮时,已经执行了RowCommand事件,即执行了删除操作,然后再引发了RowDeleting了事件,但是代码中没有定义该事件,所以出错 <asp:TemplateField HeaderText="操作">        <ItemTemplate>                 <asp:LinkButton ID="lbtnDelete" runat="server" CommandName="Delete" CommandArgument='<%#Eval("F_ID") %>' OnClientClick="return confirm('您确定要删除吗?')">[删除]</asp:LinkButton></td>          </ItemTemplate> </asp:TemplateField>解决方案:    1)你可以把【删除】按钮按钮的CommandName属性的值(原值为“delete”)修改为不是"delete"就可以了,譬如修改为“del”;   2)或者你主动添加一个RowDeleting事件,该事件中的代码为空。 <2>SqlException ,超时时间已到。在操作完成之前超时时间已过或服务器未响应。 异常信息:     异常类型: SqlException     异常消息: 超时时间已到。在操作完成之前超时时间已过或服务器未响应。获得数据连接超时。原因分析: <1>数据库正在进行备份操作。 <2>数据库设置的超时时间太短 <3>程序中获得的Connection没有及时释放 <4> 程序中的Transaction没有Commit或者RallBack 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/f_c_sh/archive/2008/06/13/2543911.aspx
      

  2.   

    没有获取到删除这一行所需要的key值,或者获取到的key为nothing
    崩掉了
      

  3.   

    我根本没有写那个“删除”按钮,  那个按钮的方法名是什么来的。? 我点不出来
    protect void ??????? (object sender, EventArgs e)
      

  4.   

    查看gridview空间的前台代码,找到RowDeleting删掉就行了
      

  5.   

    要么选择GridView的启用删除,要么就写GridView的RowDeleting事件,删除某一行。。
      

  6.   

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(this.GridView1.Rows[e.RowIndex].Cells[0].Text);
            if(newsBiz.Deletebynewsid(news_id))
            {
                Page.RegisterStartupScript("aa","<script>alert('删除成功!')</script>");
                this.GridView1.DataSource = newsBiz.SelectAll();
                this.GridView1.DataBind();
            }
        }
    写一个GridView1_RowDeleting的事件
      

  7.   

    <asp:GridView ID="GridView1" runat="server" OnRowDeleting="gv_RowDeleting">