protected void Page_Load(object sender, EventArgs e) { this.page = DTRequest.GetQueryInt("page", 1); StringBuilder sbProduct = new StringBuilder(); DataTable tabProduct = new DTcms.BLL.article().GetList("goods", 0, this.page, "", "sort_id asc,add_time desc,id desc", out this.totalCount, out pageSize).Tables[0]; string strTitle = ""; for (int i = 0; i < tabProduct.Rows.Count; i++) { strTitle = tabProduct.Rows[i]["title"].ToString(); sbProduct.Append("<div class='box_list_bb'>" + "<div class='box_list'>" + "<a href='productDetail.aspx?id=" + tabProduct.Rows[i]["id"] + "'></a>" + "<img width='165' height='185' src='" + tabProduct.Rows[i]["img_url"] + "' alt='" + tabProduct.Rows[i]["title"] + "' />" + "</div>" + "<p>" + (strTitle.Length >= 11 && strTitle != "" ? strTitle.Substring(0, 11) + "..." : strTitle) + "</p>" + "<p>兑换积分:<span>" + tabProduct.Rows[i]["point"].ToString() + "</span></p>" + "</div>"); } string pageUrl = Utils.CombUrlTxt("product.aspx", "page={0}", "__id__"); this.divProductShow.InnerHtml = sbProduct.ToString(); this.pageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 获取上一条下一条的链接 /// </summary> /// <param name="urlkey">urlkey</param> /// <param name="type">-1代表上一条,1代表下一条</param> /// <param name="defaultvalue">默认文本</param> /// <param name="callIndex">是否使用别名,0使用ID,1使用别名</param> /// <returns>A链接</returns> public string get_prevandnext_article(string urlkey, int type, string defaultvalue, int callIndex) { string symbol = (type == -1 ? "<" : ">"); DTcms.BLL.article bll = new DTcms.BLL.article(); string str = string.Empty; str = " and category_id=" + model.category_id; string orderby = type == -1 ? "id desc" : "id asc"; DataSet ds = bll.ArticleList(channel, 1, "channel_id=" + model.channel_id + " " + str + " and status=0 and Id" + symbol + id, orderby); if (ds == null || ds.Tables[0].Rows.Count <= 0) { return(defaultvalue); } if (callIndex == 1 && !string.IsNullOrEmpty(ds.Tables[0].Rows[0]["call_index"].ToString())) { return("<a href=\"" + linkurl(urlkey, ds.Tables[0].Rows[0]["call_index"].ToString()) + "\">" + ds.Tables[0].Rows[0]["title"] + "</a>"); } return("<a href=\"" + linkurl(urlkey, ds.Tables[0].Rows[0]["id"].ToString()) + "\">" + ds.Tables[0].Rows[0]["title"] + "</a>"); }