C# ASP.NET怎么根据GridView某一列的值,来删除某一行?

2025-03-23 16:09:04
推荐回答(1个)
回答1:

我直接给你粘我的代码,你有不明白的私信我.
前台:






删除" ShowDeleteButton="True">





后台:
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//if (!AdminLib.CheckPowers(UserInfo, 89))
// Response.Redirect("/HHC/error.aspx?m=您没有删除管理员的权限,请联系管理员!");
int id = Utils.StrToInt(GridView1.DataKeys[e.RowIndex].Value, -1);
if (AdminLib.DelDepartment(id))
BindData();
}