protected void btnDeleteSelected_Click(object sender, EventArgs e) { foreach (GridViewRow row in UsersGridView.Rows) { CheckBox cb = (CheckBox)row.FindControl("chkRows"); if (cb != null && cb.Checked) { string username = UsersGridView.DataKeys[row.RowIndex].Value.ToString(); MembershipUser u = Membership.GetUser(username); u.IsApproved = false; Membership.UpdateUser(u); SueetieUsers.DeactivateUser(username); lblDeleteSuccess.Visible = true; } } Response.Redirect("RegisteredUsers.aspx"); }