protected void getData() { ColumnsName = Session["ColumnsName"].ToString(); AppendWhere = Session["AppendInWhere"].ToString(); if (Session["AppendOrderby"] != null) { AppendOrderby = Session["AppendOrderby"].ToString(); } if (Request.QueryString["Grp"] != null) { AppendInGroupBy = Request.QueryString["Grp"].ToString(); } string sQuery; if (LookUpPageId.ToString() != string.Empty) { clsLookUp clp = new clsLookUp(); if (AppendInGroupBy != string.Empty) { if (txtSearch.Text != string.Empty) { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " and " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy; } else { sQuery = ColumnsName + " Where " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy; } } else { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " " + AppendInGroupBy; } else { sQuery = ColumnsName + " " + AppendInGroupBy; } } } else { if (txtSearch.Text != string.Empty) { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " and " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'"; } else { sQuery = ColumnsName + " Where " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'"; } } else { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere; } else { sQuery = ColumnsName; } } } if (AppendOrderby != string.Empty) { sQuery = sQuery + " " + AppendOrderby; } if (txtSearch.Text == string.Empty) { if (sysfuns.ExecuteQuery(sQuery, ref ds)) { GDV.AllowPaging = true; GDV.PageSize = 15; //Session["Parts"] = ds; Session["SearchParts"] = ds; GDV.DataSource = ds; GDV.DataBind(); //GDV.HeaderRow.TableSection = TableRowSection.TableHeader; } } else { if (sysfuns.ExecuteQuery(sQuery, ref ds)) { GDV.AllowPaging = false; //GDV.PageSize = 15; //Session["Parts"] = ds; Session["SearchParts"] = ds; GDV.DataSource = ds; GDV.DataBind(); //GDV.HeaderRow.TableSection = TableRowSection.TableHeader; } } } }
protected void getData() { ColumnsName = Session["ColumnsName"].ToString(); AppendWhere = Session["AppendInWhere"].ToString(); if (Session["AppendOrderby"] != null) { AppendOrderby = Session["AppendOrderby"].ToString(); } if (Request.QueryString["Grp"] != null) { AppendInGroupBy = Request.QueryString["Grp"].ToString(); } string sQuery; if (LookUpPageId.ToString() != string.Empty) { clsLookUp clp = new clsLookUp(); if (AppendInGroupBy != string.Empty) { if (txtSearch.Text != string.Empty) { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " and " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy; } else { sQuery = ColumnsName + " Where " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy; } } else { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " " + AppendInGroupBy; } else { sQuery = ColumnsName + " " + AppendInGroupBy; } } } else { if (txtSearch.Text != string.Empty) { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere + " and " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'"; } else { sQuery = ColumnsName + " Where " + rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'"; } } else { if (AppendWhere != string.Empty) { sQuery = ColumnsName + " Where " + AppendWhere; } else { sQuery = ColumnsName; } } } if (AppendOrderby != string.Empty) { sQuery = sQuery + " " + AppendOrderby; } if (LookUpPageId == 75) { string CCon = CConnection.GetConnStringForAccount(); ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, sQuery); GDV.AllowPaging = false; GDV.PageSize = ds.Tables[0].Rows.Count; //Session["Parts"] = ds; //Session["SearchParts"] = ds; GDV.DataSource = ds; GDV.DataBind(); } else { if (objMBL.ExecuteQuery(sQuery, ref ds)) { GDV.AllowPaging = true; GDV.PageSize = 15; //Session["Parts"] = ds; Session["SearchParts"] = ds; GDV.DataSource = ds; GDV.DataBind(); //GDV.HeaderRow.TableSection = TableRowSection.TableHeader; } } } }