/// <summary> /// 列表 /// </summary> /// <returns></returns> protected string GetList() { ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table(); ShowShop.BLL.Accessories.Collection bll = new ShowShop.BLL.Accessories.Collection(); ChangeHope.DataBase.DataByPage dataPage = bll.GetList(); //第一步先添加表头 table.AddHeadCol("", "<input type=\"checkbox\" id=\"chkAll\" onclick=\"CheckAll(this.form)\" alt=\"全选/取消\" />选择"); table.AddHeadCol("", "商品名称"); table.AddHeadCol("", "收藏用户"); table.AddHeadCol("", "收藏时间"); table.AddHeadCol("", "操作"); 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("<input ID=\"cBox\" type=\"checkbox\" value=\"" + dataPage.DataReader["id"].ToString() + "\" />"); table.AddCol(GetProductName(dataPage.DataReader["collectionid"].ToString())); table.AddCol(dataPage.DataReader["collectionname"].ToString()); table.AddCol(dataPage.DataReader["collectiondate"].ToString()); table.AddCol(string.Format("<a href='javascript:void(0)' onclick='Del({0})'>删除</a>", dataPage.DataReader["id"].ToString())); table.AddRow(); } } string view = table.GetTable() + dataPage.PageToolBar; dataPage.Dispose(); dataPage = null; return view; }
private void Del(string id) { ShowShop.BLL.Accessories.Collection bll = new ShowShop.BLL.Accessories.Collection(); bll.Delete(id); Response.Write("ok"); }