using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; public partial class _Default : System.Web.UI.Page { ZZY.BLL.xp_procategory ProCategoryBll = new ZZY.BLL.xp_procategory(); protected int categoryId { get { return StringUtil.QueryStringToInt32("categoryId"); } } protected int id { get { return StringUtil.QueryStringToInt32("id"); } } protected string Keywords { get { return StringUtil.QueryString("Keywords"); } } protected string strcategory = "产品", str_pageinfo, BannerUrl; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BannerUrl = new ZZY.BLL.xp_advs().GetModel(2).img; ProductBind(); } } protected void ProductBind() { string strwhere = "id>0"; if (id > 0) { ZZY.Model.xp_procategory categoryModel = new ZZY.BLL.xp_procategory().GetModel(id); if (categoryModel != null) { strcategory = categoryModel.title; } strwhere += " and categoryid=" + id + ""; } if (Keywords != "") { strwhere += " and title like '%" + TxtWriteControl.SqlFilter(HttpUtility.UrlDecode(Keywords)) + "%'"; } DataSet ds; ZZY.BLL.xp_product ProductBLL = new ZZY.BLL.xp_product(); ds = ProductBLL.GetList(strwhere); DataView dv = ds.Tables[0].DefaultView; PagedDataSource pgs = new PagedDataSource(); AspNetPager1.RecordCount = dv.Count; pgs.DataSource = dv; pgs.AllowPaging = true; pgs.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pgs.PageSize = AspNetPager1.PageSize; Rep_ProductList.DataSource = pgs; Rep_ProductList.DataBind(); if (dv.Count == 0) { this.AspNetPager1.Visible = false; str_pageinfo = "

暂无相关" + strcategory + "

"; } } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { ProductBind(); } }