public LoaiSachCollection TimDSLoaiSach(string tenloai)
        {

            LoaiSachCollection loaicoll = new LoaiSachCollection();
            SqlConnection cnn = new SqlConnection(cnnstr);
            string query = "select * from LoaiSach where tenloai <> '' ";
            query += "order by tenloai";
            SqlCommand cmd = new SqlCommand(query, cnn);
            if (tenloai != "")
            {
                query = "select * from LoaiSach where tenloai like @tenloai and tenloai <>''";
                query += "order by tenloai";
                cmd = new SqlCommand(query, cnn);
                cmd.Parameters.AddWithValue("@tenloai", "%" + tenloai + "%");
            }
            cnn.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                LoaiSachBO loaiBO = new LoaiSachBO();
                loaiBO.MaLoai = dr["maloai"].ToString();
                loaiBO.TenLoai = dr["tenloai"].ToString();
                loaicoll.Add(loaiBO);
            }
            cnn.Close();
            return loaicoll;
        }
 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();
 }