private void InitiData() { DataView dvList = new CawDBInfo().GetWaiteItems(Convert.ToString(Session["UserID"])); string Filter = "1=1"; Filter += this.drgCompany.SelectedIndex == 0 ? "" : " AND SUBMITORGID='" + this.drgCompany.SelectedValue+"'"; Filter +=this.DateSend.FromText.Trim()!="" && this.DateSend.ToText.Trim()=="" ? " AND SUBMITDATE>='"+this.DateSend.FromText.Trim()+"'" : "" ; Filter +=this.DateSend.FromText.Trim()=="" && this.DateSend.ToText.Trim()!="" ? " AND SUBMITDATE<='"+this.DateSend.ToText.Trim()+"'" : "" ; Filter += this.DateSend.FromText.Trim() != "" && this.DateSend.ToText.Trim() != "" ? " AND SUBMITDATE>='"+this.DateSend.FromText.Trim()+ "' AND SUBMITDATE<='" + this.DateSend.ToText.Trim()+"'" : "" ; dvList.RowFilter = Filter; this.GridView1.DataSource = dvList; this.GridView1.DataBind(); }
private void InitiData() { DataView dvList = new CawDBInfo().GetWaiteItems(Convert.ToString(Session["UserID"])); string Filter = "1=1"; if (DateSend.FromText.Trim() != "") { Filter += " AND SUBMITDATE>= #" + this.DateSend.FromText + "#"; } if (DateSend.ToText.Trim() != "") { Filter += " AND SUBMITDATE<= #" + this.DateSend.ToText + "#"; } dvList.RowFilter = Filter; this.GridView1.DataSource = dvList; this.GridView1.DataBind(); }