protected void BindProductBrand() { ShowShop.BLL.Product.ProductBrand bll = new ShowShop.BLL.Product.ProductBrand(); ChangeHope.DataBase.DataByPage dataPage = bll.GetList(); this.w_d_pro_BrandID.Items.Add(new ListItem("--所有品牌--", "")); if (dataPage.DataReader != null) { while (dataPage.DataReader.Read()) { this.w_d_pro_BrandID.Items.Add(new ListItem(dataPage.DataReader["name"].ToString(), dataPage.DataReader["bid"].ToString())); } } }
/// <summary> /// 列表 /// </summary> /// <returns></returns> protected string GetList() { ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter(); ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table(); ShowShop.BLL.Product.ProductBrand data = new ShowShop.BLL.Product.ProductBrand(); ChangeHope.DataBase.DataByPage dataPage = data.GetList(); //第一步先添加表头 table.AddHeadCol("5%", "序号"); table.AddHeadCol("25%", "品牌名称"); table.AddHeadCol("25%", "排序"); table.AddHeadCol("25%", "操作"); table.AddRow(); //添加表的内容 if (dataPage.DataReader != null) { int curpage = ChangeHope.WebPage.PageRequest.GetInt("pageindex"); if (curpage < 0) { curpage = 1; } int count = 0; while (dataPage.DataReader.Read()) { count++; string No = (15 * (curpage - 1) + count).ToString(); table.AddCol(No); table.AddCol(dataPage.DataReader["name"].ToString()); table.AddCol(string.Format("<input id='sort{0}' value='{1}' size='5' onblur='Sort({0},{1})'/>", dataPage.DataReader["bid"].ToString(), dataPage.DataReader["sort"].ToString())); table.AddCol(string.Format("<a href=productbrand_edit.aspx?id={0}>编辑</a> <a href='#' onclick='Del({0})'>删除</a>", dataPage.DataReader["bid"].ToString())); table.AddRow(); } } string view = table.GetTable() + dataPage.PageToolBar; dataPage.Dispose(); dataPage = null; return view; }