protected void LoaisachGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "xoa") { string maloai = (e.CommandArgument).ToString(); loaisachBUS.XoaLoaiSach(maloai); NapDuLieu(); } else if (e.CommandName == "sua") { LoaiSachCollection loaisachcoll = new LoaiSachCollection(); loaisachcoll = loaisachBUS.TimDSLoaiSach(TimTextbox.Text); int index = Convert.ToInt32(e.CommandArgument.ToString()); ViewState["MaLoai"] = loaisachcoll.Index(index).MaLoai; string tenloai = loaisachcoll.Index(index).TenLoai; SuaPopup.Show(); SuaTextBox.Text = tenloai; } }
public void NapLoaiSach() { LoaisachDropdown.Items.Clear(); LoaiSachCollection source = new LoaiSachCollection(); LoaiSachBO loaisachBO= new LoaiSachBO(); loaisachBO.TenLoai = "Tất cả"; loaisachBO.MaLoai = ""; source.Add(loaisachBO); //add LoaiSachCollection temp = new LoaiSachCollection(); temp = loaisachBUS.TimDSLoaiSach(""); for (int i = 0; i < temp.Count; i++) { source.Add(temp.Index(i)); } LoaisachDropdown.DataSource =source; LoaisachDropdown.DataTextField = "TenLoai"; LoaisachDropdown.DataValueField = "Maloai"; LoaisachDropdown.DataBind(); }