コード例 #1
0
        protected void btnXoa_Click(object sender, EventArgs e)
        {
            Button      btnXoa = sender as Button;
            GridViewRow grvr   = btnXoa.NamingContainer as GridViewRow;
            int         userid = int.Parse(GridView2.DataKeys[grvr.RowIndex].Value.ToString());

            bus.DeleteUser(userid);
            string alert = "xóa thành công";

            Response.Redirect("~/Page/Admin/user/User.aspx?alert=" + alert);
        }
コード例 #2
0
 private void btnDeleteUser_Click(object sender, EventArgs e)
 {
     if (gridUser.RowCount > 0)
     {
         DataRow      row          = gridUser.GetDataRow(gridUser.GetSelectedRows()[0]);
         DialogResult dialogResult = MessageBox.Show("Are you sure?", "Delete user", MessageBoxButtons.YesNo);
         if (dialogResult == DialogResult.Yes)
         {
             User_BUS.DeleteUser(row["IDUser"].ToString());
             MessageBox.Show("User was deleted", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         dgvListUser.DataSource = User_BUS.ListUsers();
     }
     else
     {
         MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }