//分页 protected PagedDataSource PsPageData() { Item bll = new Item(); PagedDataSource ps = new PagedDataSource(); if (Request.QueryString["Category"] != null) { txtCategory = Request.QueryString["Category"].ToString(); } else { txtCategory = "Dress"; } ps.DataSource = bll.GetItemByAllCategory(txtCategory); ps.AllowPaging = true; ps.PageSize = 24; string txtPa = Request.QueryString["page"]; string txtCurrent = string.Empty; if (txtPa != null) { ps.CurrentPageIndex = Convert.ToInt32(txtPa) - 1; } else { ps.CurrentPageIndex = 0; } RepeaterCategory.DataSource = ps; RepeaterCategory.DataBind(); return(ps); }
protected PagedDataSource PsPageData() { Item bll = new Item(); PagedDataSource ps = new PagedDataSource(); txtPriceStart = Request.QueryString["PriceStart"]; txtPriceEnd = Request.QueryString["PriceEnd"]; ps.DataSource = bll.SearchItemByCategoryIdByItem(Request.QueryString["Category"], Request.QueryString["Product"], decimal.Parse(txtPriceStart), decimal.Parse(txtPriceEnd), Request.QueryString["Key"]); ps.AllowPaging = true; ps.PageSize = 24; string txtPa = Request.QueryString["page"]; string txtCurrent = string.Empty; if (txtPa != null) { ps.CurrentPageIndex = Convert.ToInt32(txtPa) - 1; } else { ps.CurrentPageIndex = 0; } RepeaterCategory.DataSource = ps; RepeaterCategory.DataBind(); if (ps.PageSize < 1) { ContentNav.InnerHtml = "没有找到你您所需要的信息"; } return(ps); }
private void BindCategoryRepeater() { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyWebsiteDB"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("select * from Tbl_Category", con)) { using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { DataTable dt = new DataTable(); sda.Fill(dt); RepeaterCategory.DataSource = dt; RepeaterCategory.DataBind(); } } } }
private void LoadCategory() { using (SqlConnection sqlconn = new SqlConnection(conStr)) { using (SqlCommand cmd = new SqlCommand()) { sqlconn.Open(); cmd.Connection = sqlconn; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "getAllCategories"; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); RepeaterCategory.DataSource = dt; RepeaterCategory.DataBind(); } } }
//分页 protected PagedDataSource PsPageData() { UserMess dll = new UserMess(); PagedDataSource ps = new PagedDataSource(); ps.DataSource = dll.GetUserMess(); ps.AllowPaging = true; ps.PageSize = 10; string txtPa = Request.QueryString["page"]; string txtCurrent = string.Empty; if (txtPa != null) { ps.CurrentPageIndex = Convert.ToInt32(txtPa) - 1; } else { ps.CurrentPageIndex = 0; } RepeaterCategory.DataSource = ps; RepeaterCategory.DataBind(); return(ps); }
protected PagedDataSource PsPageData() { Item bll = new Item(); PagedDataSource ps = new PagedDataSource(); ps.DataSource = bll.SearchItemByCategoryId(Request.QueryString["Category"], Request.QueryString["Key"]); ps.AllowPaging = true; ps.PageSize = 24; string txtPa = Request.QueryString["page"]; string txtCurrent = string.Empty; if (txtPa != null) { ps.CurrentPageIndex = Convert.ToInt32(txtPa) - 1; } else { ps.CurrentPageIndex = 0; } RepeaterCategory.DataSource = ps; RepeaterCategory.DataBind(); return(ps); }
void RepeaterCategory_Yukle() { RepeaterCategory.DataSource = repoCategory.GetAll().Where(w => w.CatID == 0).ToList(); RepeaterCategory.DataBind(); }