当前位置: 代码迷 >> ASP.NET >> GridView删除数据的有关问题
  详细解决方案

GridView删除数据的有关问题

热度:1251   发布时间:2013-02-25 00:00:00.0
GridView删除数据的问题
C# code
protected void gvTourInfo_RowCommand(object sender, GridViewCommandEventArgs e)    {        Business busi = new Business();        if (e.CommandName == "Delete")        {            int ID = Convert.ToInt32(e.CommandArgument);            if (busi.DelectYudingInfo(ID) > 0)            {                Response.Write("<script> alert('你已删除成功!'); </script>");            }            else            {                Response.Write("<script> alert('删除失败!'); </script>");            }        }        this.gvTourInfo.EditIndex = -1;        BindData();    }


为什么不能删除啦,错误信息是未激活RowDeleteing事件

------解决方案--------------------------------------------------------
如果你想自定义删除过程,那就不要把CommandName设成Delete,像Select, Insert, New, Update, Delete这几个都可以看作是‘关键字’。起别的名字吧。