public void DataBindToGridview() { ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao(); if (Request.QueryString["Type"].ToString().Trim() == "单位") { GVData.DataSource = MyModel.GetList("TypeStr='" + Request.QueryString["Type"].ToString().Trim() + "' and TitleStr Like '%" + this.TextBox1.Text + "%' and (UserBuMen='所有部门' or UserName='******' or ','+UserBuMen+',' like '%," + ZWL.Common.PublicMethod.GetSessionValue("Department") + ",%') order by ID desc"); } else { GVData.DataSource = MyModel.GetList("TypeStr='" + Request.QueryString["Type"].ToString().Trim() + "' and TitleStr Like '%" + this.TextBox1.Text + "%' and UserBuMen='" + ZWL.Common.PublicMethod.GetSessionValue("Department") + "' order by ID desc"); } GVData.DataBind(); LabPageSum.Text = Convert.ToString(GVData.PageCount); LabCurrentPage.Text = Convert.ToString(((int)GVData.PageIndex + 1)); this.GoPage.Text = LabCurrentPage.Text.ToString(); }
public void DataBindToGridview() { GVData.PageSize = AspNetPager1.PageSize; GVData.PageIndex = AspNetPager1.CurrentPageIndex - 1; ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao(); DataSet ds = new DataSet(); if (Request.QueryString["Type"].ToString().Trim() == "单位") { ds = MyModel.GetList("TypeStr='" + Request.QueryString["Type"].ToString().Trim() + "' and TitleStr Like '%" + this.TextBox1.Text + "%' order by ID desc"); } else { ds = MyModel.GetList("TypeStr='" + Request.QueryString["Type"].ToString().Trim() + "' and TitleStr Like '%" + this.TextBox1.Text + "%' and UserBuMen='" + ZWL.Common.PublicMethod.GetSessionValue("Department") + "' order by ID desc"); } GVData.DataSource = ds; GVData.DataBind(); AspNetPager1.RecordCount = ds.Tables[0].Rows.Count; }