protected void BindGvAcs() { 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 = '" + ddlbuyerAcs.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()); GvAcs.DataSource = ds; GvAcs.DataBind(); int columncount = GvAcs.Rows[0].Cells.Count; GvAcs.Rows[0].Cells.Clear(); GvAcs.Rows[0].Cells.Add(new TableCell()); GvAcs.Rows[0].Cells[0].ColumnSpan = columncount; GvAcs.Rows[0].Cells[0].Text = ""; } else { //Search Option-RUS ViewState["dtOrder"] = ds.Tables[0]; //Search Option-RUS GvAcs.DataSource = ds; GvAcs.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 + "%'"; GvAcs.DataSource = dvOrder; GvAcs.DataBind(); }