“System.Web.UI.WebControls.GridViewDeletedEventArgs”并不包含“RowIndex”的定义 5
protectedvoidGridView1_RowDeleting(objectsender,GridViewDeleteEventArgse){if(Session[...
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
if (Session["UserName"] == null && Session["UserPwd"] == null)
{
Response.Redirect("~/denglu.aspx");
}
else
{
if (Session["UserName"].ToString() == "Tsoft" && Session["UserPwd"].ToString() == "111")
{
string UserId = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
SqlConnection con = DB.createDB();
con.Open();
SqlCommand cmd = new SqlCommand("delete from tb_Users where (UserName NOT IN ('Tsoft')) AND UserId='" + UserId + "' ", con);
cmd.ExecuteNonQuery();
this.aa();
this.GridView1.EditIndex = -1;
}
else
{
Response.Write("<script>alert('你没有权限删除,必须是管理员才能进行删除操作!');location='javascript:history.go(-1)'</script>"); } } 展开
{
if (Session["UserName"] == null && Session["UserPwd"] == null)
{
Response.Redirect("~/denglu.aspx");
}
else
{
if (Session["UserName"].ToString() == "Tsoft" && Session["UserPwd"].ToString() == "111")
{
string UserId = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
SqlConnection con = DB.createDB();
con.Open();
SqlCommand cmd = new SqlCommand("delete from tb_Users where (UserName NOT IN ('Tsoft')) AND UserId='" + UserId + "' ", con);
cmd.ExecuteNonQuery();
this.aa();
this.GridView1.EditIndex = -1;
}
else
{
Response.Write("<script>alert('你没有权限删除,必须是管理员才能进行删除操作!');location='javascript:history.go(-1)'</script>"); } } 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询