Example #1
0
        protected void ddlLoai_SelectedIndexChanged(object sender, EventArgs e)
        {
            chucnag cn = new chucnag();

            if (ddlLoai.SelectedValue.ToString() == "TG")
            {
                ddlChiTiet.DataSource     = cn.GetTacGia();
                ddlChiTiet.DataTextField  = "TenTacGia";
                ddlChiTiet.DataValueField = "MaTacGia";
                ddlChiTiet.DataSourceID   = null;
                ddlChiTiet.DataBind();
            }
            else if (ddlLoai.SelectedValue.ToString() == "NXB")
            {
                ddlChiTiet.DataSource     = cn.GetNhaXuatBan();
                ddlChiTiet.DataTextField  = "TenNhaXB";
                ddlChiTiet.DataValueField = "MaNhaXB";
                ddlChiTiet.DataSourceID   = null;
                ddlChiTiet.DataBind();
            }
            else
            {
                ddlChiTiet.DataSource     = cn.GetLoaiSach();
                ddlChiTiet.DataTextField  = "TenLoaiSach";
                ddlChiTiet.DataValueField = "MaLoai";
                ddlChiTiet.DataSourceID   = null;
                ddlChiTiet.DataBind();
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            chucnag cn = new chucnag();

            if (!IsPostBack)
            {
                lblNhan.Text = "Xin chào: " + Session["masv"].ToString();
                DoDuLieuVaoGridView();
                ddlChiTiet.DataSource     = cn.GetTacGia();
                ddlChiTiet.DataTextField  = "TenTacGia";
                ddlChiTiet.DataValueField = "MaTacGia";
                ddlChiTiet.DataSourceID   = null;
                ddlChiTiet.DataBind();
            }
        }