这个是本人的界面,根据选中的行来进行删除GridView中的行
这个是本人的代码,删除代码
这个是生成的错误信息.请问哪个高人能够指点指点.本人还是个在校学生要做个固定资产管理系统网站,希望好心人能够指导指导该学生!
谢谢!

解决方案 »

  1.   

    恩是啊
    这个是什么事件..我在我的GridVeiw内没找到这个事件啊!
    有点奇怪.
      

  2.   

    建议把删除按钮对应的列在GridView中改成TemplateField.
    <asp:TemplateField ShowHeader="False">
        <ItemTemplate>
              <asp:Button ID="ButtonDelete" runat="server" CausesValidation="False" 
                                CommandName="Delete" Text="删除">
            </asp:Button>
        </ItemTemplate>
    </asp:TemplateField> protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes["onmouseover"] = "currentcolor=this.style.backgroundColor; this.style.backgroundColor='#C9D9FB'";
                e.Row.Attributes["onmouseout"] = "this.style.backgroundColor=currentcolor;";            Button btn = (Button)e.Row.FindControl("ButtonDelete");
                DataRowView drv = (DataRowView)e.Row.DataItem;
                btn.OnClientClick = "return confirm('你确实要删除[" + drv["WarehouseName"].ToString() + "]吗?');";
            }
    }
      

  3.   


    不可能,你是用VS2005吗?如果是的话,你先选中GridView,然后在属性中的雷电状项中可以选择RowDeleting事件。
      

  4.   

    定义GridView RowDeleting事件就行了。