protected void _allUser_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "changestatus") { Int32 id = Int32.Parse(e.CommandArgument.ToString()); String status = _allUser.Rows[id].Cells[5].Text.ToString(); String email = _allUser.Rows[id].Cells[3].Text.ToString(); if (RepositoryUser.Email(email).Email != Session["Email"].ToString()) { if (status == "Active") { RepositoryUser.ChangeToBlocked(email); } else if (status == "Blocked") { RepositoryUser.ChangeToActive(email); } } else { Response.Write("<script>alert('Can not change current login admin status.')</script>"); } } refresh(); }