private void loadDMlv1() { danhmucBLL bs = new danhmucBLL(); List <danhmucDAL> list = bs.getDanhMuclv(1); rpLV2.DataSource = bs.getDanhMuclv(1); rpLV2.DataBind(); for (int i = 0; i <= list.Count - 1; i++) { Label lbDanhMucSTT = rpLV2.Items[i].FindControl("lbDanhMucSTT") as Label; lbDanhMucSTT.Text = (i + 1).ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Convert.ToInt32(Request.QueryString["id"]); danhmucBLL bs = new danhmucBLL(); if (Request.QueryString["id"] != null) { List <danhmucDAL> ds = bs.getDanhMucbyId(id); if (ds.Count == 1) { txtTen.Text = ds[0].ten_danhmuc; } else { Response.Redirect("error.aspx"); } } else { Response.Redirect("error.aspx"); } ddlDM.DataSource = bs.getDanhMuclv(1); ddlDM.DataValueField = "groupdanhmuc"; ddlDM.DataTextField = "ten_danhmuc"; ddlDM.DataBind(); List <danhmucDAL> list = bs.getDanhMucbyId(id); ddlDM.SelectedValue = Convert.ToString(list[0].groupdanhmuc - 0.1); } }
// load danh muc; private void loadDanhMuc() { danhmucBLL bs = new danhmucBLL(); ddlDM.DataSource = bs.getDanhMuclv(2); ddlDM.DataTextField = "ten_danhmuc"; ddlDM.DataValueField = "id_danhmuc"; ddlDM.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { danhmucBLL bs = new danhmucBLL(); ddlDM.DataSource = bs.getDanhMuclv(1); ddlDM.DataValueField = "groupdanhmuc"; ddlDM.DataTextField = "ten_danhmuc"; ddlDM.DataBind(); } }
private void loadDMlv2() { danhmucBLL bs = new danhmucBLL(); //DropDownList ddlLevel = rpLV1.Items[0].FindControl("ddlLevel") as DropDownList; List <danhmucDAL> ds = bs.getDanhMuclv(1); ddlLevel.Items.Add("Tất cả"); ddlLevel.DataSource = ds; ddlLevel.DataTextField = "ten_danhmuc"; ddlLevel.DataValueField = "groupdanhmuc"; ddlLevel.DataBind(); double index = Convert.ToDouble(ddlLevel.SelectedValue) + 0.1; List <danhmucDAL> list = bs.getDanhMuclvXem(index); rpLV1.DataSource = list; rpLV1.DataBind(); for (int i = 0; i <= rpLV1.Items.Count - 1; i++) { Label lbDanhMucSTT = rpLV1.Items[i].FindControl("lbDanhMucSubSTT") as Label; lbDanhMucSTT.Text = (i + 1).ToString(); } }