gridview编辑、删除

2024-12-27 23:34:28
推荐回答(2个)
回答1:

gridview 添加删除列,点击的时候取得列[id]的值
执行sql语句 ExecuteNonQuery("delete from user where id ="+id)

编辑的时候 update就可以

回答2:

OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating">








protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//删除
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
//编辑
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
//取消(编辑)
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//保存(编辑)
}