protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e) { try { if (!Page.IsPostBack) { string name = QueryStringHelper.GetString("title"); int stateid = QueryStringHelper.GetInt("stateid"); InitData(e.NewPageIndex, name, stateid); } } catch (Exception ex) { log.Error(ex.Message); } }
private void InitData(int PageIndex, string name, int stateid) { this.Title = "链接列表"; // 设置标题 DataSet ds = new DataSet(); int recordcount = 0; //获取总条数 string where = string.Empty; if (!string.IsNullOrEmpty(name)) { where = "title like '%" + name + "%'"; } if (stateid >= 0) { if (!string.IsNullOrEmpty(where)) { where += " and "; } where += " stateid=" + stateid; ddlState.SelectedValue = stateid + ""; } int ppid = QueryStringHelper.GetInt("txtAID"); if (ppid > 0) { if (!string.IsNullOrEmpty(where)) { where += " and "; } where += " qicq='" + ppid + "'"; } //txtAID //搜索 ds = bll.GetList(AspNetPager1.PageSize, PageIndex, where, out recordcount); AspNetPager1.RecordCount = recordcount; this.rptBind.DataSource = ds.Tables[0].DefaultView; this.rptBind.DataBind(); }
private void InitData(int PageIndex, string name, int parentId) { this.Title = "列表"; // 设置标题 DataSet ds = new DataSet(); int recordcount = 0; //获取总条数 string wheStr = string.Empty; int sHotid = QueryStringHelper.GetInt("sHotID"); if (sHotid == 1) { chkIsHot.Checked = true; wheStr = "isHot=1"; } int sTjid = QueryStringHelper.GetInt("sTuiJian"); if (sTjid == 1) { chkTuiJian.Checked = true; if (!string.IsNullOrEmpty(wheStr)) { wheStr += " and "; } wheStr += " isTuijian=1"; } int siscx = QueryStringHelper.GetInt("iscx"); if (siscx == 1) { chkIsCX.Checked = true; if (!string.IsNullOrEmpty(wheStr)) { wheStr += " and "; } wheStr += " desFild1=1"; } if (!name.Equals(string.Empty) || parentId != -1) { ddlType.SelectedValue = parentId + ""; //搜索 ds = bll.GetSearchNameList(AspNetPager1.PageSize, PageIndex, name, parentId, wheStr, out recordcount); try { txtSearchName.Text = name; } catch { } } else { ds = bll.GetAllListByCodeNo(AspNetPager1.PageSize, PageIndex, CodeNo, wheStr, out recordcount); } AspNetPager1.RecordCount = recordcount; DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { dt.Columns.Add("pcodeNo", typeof(string)); foreach (DataRow dr in dt.Rows) { dr["pcodeNo"] = codeNo; } } this.rptBind.DataSource = ds.Tables[0].DefaultView; this.rptBind.DataBind(); }