如何在Gridview中的一列模板中操作行,不使用GridView自带的(删除,更新)

2025-03-22 18:41:09
推荐回答(1个)
回答1:

不使用GridView自带的(删除,更新)需要使用girdview的 GridView_RowCommand 事件在grid里面的控件如button 定义 command 属性在gridview的 GridView_RowCommand 里面处理对应的command就好 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
 if (e.CommandName == "Delete")
 {
  int id = Convert.ToInt32(e.CommandArgument);
  // 删除记录的专门过程
  DeleteRecordByID(id);
 }
}