//Grid protected void BindGvY() { conn.Open(); string strSelectCmd = "SELECT * FROM View_Tna_Plan WHERE PO_Ship_Date is NULL AND ActiveOrder='1' AND TnAapproved IS NOT NULL AND TnaByrNm = '" + dlbuyerY.SelectedItem.Value + "'order by ord_no,po_xfactory ASC"; SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, conn); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count == 0) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GvY.DataSource = ds; GvY.DataBind(); int columncount = GvY.Rows[0].Cells.Count; GvY.Rows[0].Cells.Clear(); GvY.Rows[0].Cells.Add(new TableCell()); GvY.Rows[0].Cells[0].ColumnSpan = columncount; GvY.Rows[0].Cells[0].Text = ""; } else { //Search Option-RUS ViewState["dtOrder"] = ds.Tables[0]; //Search Option-RUS GvY.DataSource = ds; GvY.DataBind(); } }
protected void BindGvY() { conn.Open(); string strSelectCmd = "SELECT * FROM tbl_problemfollow WHERE done is NULL AND dpt_nm = '" + GetDpt.SelectedItem.Text + "' order by pid ASC"; SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, conn); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count == 0) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GvY.DataSource = ds; GvY.DataBind(); int columncount = GvY.Rows[0].Cells.Count; GvY.Rows[0].Cells.Clear(); GvY.Rows[0].Cells.Add(new TableCell()); GvY.Rows[0].Cells[0].ColumnSpan = columncount; GvY.Rows[0].Cells[0].Text = ""; } else { //Search Option-RUS ViewState["dtOrder"] = ds.Tables[0]; //Search Option-RUS GvY.DataSource = ds; GvY.DataBind(); } }
//Search Option-RUS protected void btnSearch_Click(object sender, EventArgs e) { DataTable dtOrder = (DataTable)ViewState["dtOrder"]; DataView dvOrder = dtOrder.DefaultView; dvOrder.RowFilter = "ord_no like '" + txtSearch.Text + "%'"; GvY.DataSource = dvOrder; GvY.DataBind(); }