protected void Page_Load(object sender, EventArgs e) { try { DTOKhachHang dto = new DTOKhachHang(); DAO_Entity daokh = new DAO_Entity(); XuLy_TiepNhanDonHang control = new XuLy_TiepNhanDonHang(); control.LayDSKhachHang(); List<DTOKhachHang> Dskh = daokh.TaoDSKH(); GridDSKH.DataSource = Dskh; GridDSKH.DataBind(); } catch (Exception) { Response.Write("<script>alert('Loi tai du lieu!')</script>"); } ThemKH.Visible = false; if (IsPostBack == false) { List<DTOLoaiKH> dsLKH = new List<DTOLoaiKH>(); DAO_Entity daoKH = new DAO_Entity(); dsLKH = daoKH.LayDSLKH(); //hien thi ten loai KH ra dropdownlist ddLoaiKH.DataTextField = "TenLKH";//TenLKH la thuoc tinh trong DTOLoaiKH //truyen dl theo ma loai ddLoaiKH.DataValueField = "MaLKH";//MaLKH la thuoc tinh trong DTOLoaiKH ddLoaiKH.DataSource = dsLKH; ddLoaiKH.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { try { DAO_Entity daokh = new DAO_Entity(); List<DTOKhachHang> dsKH = daokh.TaoDSKH(); GridKH.DataSource = dsKH; GridKH.DataBind(); } catch (Exception) { Response.Write("<script>alert('Loi tai du lieu!')</script>"); } }
public void LayDSKhachHang() { DAO_Entity dao = new DAO_Entity(); dao.TaoDSKH(); }