public void DataBindToGridview() { ZWL.BLL.ERPSupplys MyModel = new ZWL.BLL.ERPSupplys(); string sql = ""; if (!string.IsNullOrEmpty(this.TextBox1.Text)) { sql += "(SupplysName Like '%" + this.TextBox1.Text + "%' or Serils Like '%" + this.TextBox1.Text + "%' or JianCheng Like '%" + this.TextBox1.Text + "%' or MobTel Like '%" + this.TextBox1.Text + "%' or UserName Like '%" + this.TextBox1.Text + "%' or ChuanZhen Like '%" + this.TextBox1.Text + "%' or DiQu Like '%" + this.TextBox1.Text + "%')"; } if (!string.IsNullOrEmpty(this.TextBox3.Text)) { if (string.IsNullOrEmpty(sql)) { sql += " TimeStr >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TimeStr<='" + this.TextBox4.Text.Trim() + " 23:59:59' "; } else { sql += "and TimeStr >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TimeStr<='" + this.TextBox4.Text.Trim() + " 23:59:59' "; } sql += " order by ID desc"; } GVData.DataSource = MyModel.GetList(sql); 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() { ZWL.BLL.ERPSupplys MyModel = new ZWL.BLL.ERPSupplys(); GVData.DataSource = MyModel.GetList("SupplysName Like '%" + this.TextBox1.Text + "%' 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(); }