protected void suaDanhMuc_Command(object sender, CommandEventArgs e) { if (e.CommandName == "suaDanhMuc") { int update = Convert.ToInt16(e.CommandArgument); danhMuc danhMuc = getDanhMuc.get1danhMuc(update); Session["ma"] = danhMuc; Response.Redirect("SuaDanhMuc.aspx"); } }
protected void btnaddcategory_Click(object sender, EventArgs e) { try { danhMuc danhMuc = new danhMuc(); danhMuc.tendanhmuc = txtTenDanhMuc.Text; getDanhMuc.themDanhMuc(danhMuc); msgaddcategory.Text = "Thêm thành công"; } catch { msgaddcategory.Text = "Có lỗi"; } }
protected void btnupdatecategory_Click(object sender, EventArgs e) { try { danhMuc danhMuc = (danhMuc)Session["ma"]; danhMuc.tendanhmuc = txtTenDanhMuc.Text; getDanhMuc.suaDanhMuc(danhMuc); msgudpatecategory.Text = "Cập nhật thành công"; } catch { msgudpatecategory.Text = "Có lỗi, không cập nhật được"; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["TaiKhoan"] != null) { } else { Response.Redirect("../../index.aspx"); } if (!IsPostBack) { danhMuc danhMuc = (danhMuc)Session["ma"]; txtTenDanhMuc.Text = danhMuc.tendanhmuc; DataBind(); } }