正常的e.rowindex的值应该是本行在gridview表中的索引,但在本程序中却是数据库中的一个ID。
protected void GV_ForgetList_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string uid = e.RowIndex.ToString();
string js = "<script>aler(忘记密码申请删除";
user stu = new user();
if(stu.ForgetPasswordDel(uid))
js=js+"成功!);";
else
js=js+"失败!);";
Page.RegisterClientScriptBlock("delfglist", js);
}
找了很久,原来原因是因为在
protected void GV_ForgetList_RowDataBound(object sender, GridViewRowEventArgs e)
{
btnDelete.CommandArgument=uid;//把一句删除掉就没事了。
}