如图:
我在GridView里面添加了AutoGenerateEditButton="True"和AutoGenerateDeleteButton="True"UpdateCommand="update [Category] set[cate_Name]=@cate_Name where [cate_ID]=[cate_ID]"//这里我不知道该怎么写,
where后面应该是错误的。
当我点击“编辑”的时候,他会把所有的cate_Name列都修改了,我想应该是UpdateCommand语句写错了的,where这里应该怎么写?
怎样才能点击编辑的时候只编辑对应的行内容??

解决方案 »

  1.   

    看不到图,不过我想在编辑的时候传入相对应的记录的ID进去的就可以了,你可以设置datakeysName="cate_ID"
      

  2.   

    有个编辑事件啊,可以这样获得哦!
    protected void gvCustomer_RowEditing(object sender,GridViewEditEventArgs e)
    {    gvCustomer.EditIndex = e.NewEditIndex;  
    }
      

  3.   

    UpdateCommand="update [Category] set [cate_Name]=@cate_Name where [cate_ID]=@cate_ID"切换到设计视图用可视化工具配置数据源和GridView比较简单