protected void Page_Load(object sender, EventArgs e) { StringBuilder stringBuilder = new StringBuilder(); dt_expert dtExpert = new dt_expert(); DataSet dt = dtExpert.GetList(""); DataTable dtImg = new DataTable(); HyFileatt hyFileatt = new HyFileatt(); //控制数据条数 int s = 0; if (dt.Tables[0].Rows.Count > 0) { //分行 int n = 0; if ((dt.Tables[0].Rows.Count) % 4 == 0) { n = (dt.Tables[0].Rows.Count) / (4); } else { n = ((dt.Tables[0].Rows.Count) / (4)) + 1; } //构造列 for (int i = 0; i < n; ++i) { stringBuilder.Append("<ul>"); //控制循环条件 int m = 0; if ((dt.Tables[0].Rows.Count - (i * 4)) > 4) { m = 4; } else { m = dt.Tables[0].Rows.Count - (i * 4); } for (int j = 0; j < m; j++) { dtImg = hyFileatt.Getdocsfm(dt.Tables[0].Rows[s]["ID"].ToString()); stringBuilder.Append("<li><a href=\"showExportMain.aspx?docid=" + dt.Tables[0].Rows[s]["ID"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "\">"); if (dtImg.Rows.Count > 0) { stringBuilder.Append("<img src=\"" + dtImg.Rows[0]["hy_filepath"].ToString() + "\">"); } else { stringBuilder.Append("<img src=\"Images/Img.jpg\">"); } dtImg.Clear(); stringBuilder.Append("<dt align=\"center\" >" + dt.Tables[0].Rows[s]["dt_name"].ToString() + "</dt></a></li>"); s++; } stringBuilder.Append("</ul>"); } } this.lb_show.Text = stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["page"] != null) { try { pageNo = Convert.ToInt32(this.Request.QueryString["page"].ToString()); } catch { pageNo = 1; } } StringBuilder stringBuilder = new StringBuilder(); dt_expert dtExpert = new dt_expert(); DataSet dt = dtExpert.GetListPage(pageNo, pageSize, ""); DataSet dtDataSet = dtExpert.GetList(""); totalPage = dtDataSet.Tables[0].Rows.Count / pageSize; if (dtDataSet.Tables[0].Rows.Count % pageSize > 0) { totalPage++; } this.lb_page.Text = HyCommon.page("\"#Pagle\"", pageNo.ToString(), pageSize.ToString(), totalPage.ToString(), ""); DataTable dtImg = new DataTable(); HyFileatt hyFileatt = new HyFileatt(); //控制数据条数 int s = 0; if (dt.Tables[0].Rows.Count > 0) { //分行 int n = 0; if ((dt.Tables[0].Rows.Count) % 4 == 0) { n = (dt.Tables[0].Rows.Count) / (4); } else { n = ((dt.Tables[0].Rows.Count) / (4)) + 1; } //构造列 for (int i = 0; i < n; ++i) { stringBuilder.Append("<ul>"); //控制循环条件 int m = 0; if ((dt.Tables[0].Rows.Count - (i * 4)) > 4) { m = 4; } else { m = dt.Tables[0].Rows.Count - (i * 4); } for (int j = 0; j < m; j++) { dtImg = hyFileatt.Getdocsfm(dt.Tables[0].Rows[s]["ID"].ToString()); stringBuilder.Append("<li><a href=\"showExportMain.aspx?docid=" + dt.Tables[0].Rows[s]["ID"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "\">"); if (dtImg.Rows.Count > 0) { stringBuilder.Append("<img src=\"" + dtImg.Rows[0]["hy_filepath"].ToString() + "\">"); } else { stringBuilder.Append("<img src=\"Images/Img.jpg\">"); } dtImg.Clear(); stringBuilder.Append("<dt align=\"center\" >" + dt.Tables[0].Rows[s]["dt_name"].ToString() + "</dt></a></li>"); s++; } stringBuilder.Append("</ul>"); } } this.lb_show.Text = stringBuilder.ToString(); }
// 数据绑定 private void RptBind() { HyCommon HyCommon = new HyCommon(); //获取当前页数 if (this.Request.QueryString["page"] != null) { this.page = int.Parse(HyCommon.Filter(this.Request.QueryString["page"].ToString())); } this.txtPageNum.Text = this.pageSize.ToString(); dt_expert dtExpert = new dt_expert(); string strWhere = ""; if (this.txtNmae.Text.Trim() != "") { strWhere += " and dt_name like '%" + this.txtNmae.Text.Trim() + "%'"; } //获取数据 DataSet dt = dtExpert.GetDataPage(this.pageSize, this.page, strWhere); //获取数据条数 this.totalCount = dtExpert.GetList(strWhere).Tables[0].Rows.Count; this.lblcount.Text = totalCount.ToString(); rptList.DataSource = dt; rptList.DataBind(); //地址传递数据 string pageUrl = HyCommon.CombUrlTxt(ls_url, "page={0}&rnd={1}&txtNmae={2}", "__id__", System.Guid.NewGuid().ToString(), this.txtNmae.Text); PageContent.InnerHtml = HyCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }