protected void BindGvAOP() { conn.Open(); string strSelectCmd = "SELECT * FROM View_Tna_Plan WHERE PO_Ship_Date is NULL AND (Aop='Y') AND ActiveOrder='1' AND TnAapproved IS NOT NULL AND TnaByrNm = '" + ddlbuyerAOP.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()); GvAOP.DataSource = ds; GvAOP.DataBind(); int columncount = GvAOP.Rows[0].Cells.Count; GvAOP.Rows[0].Cells.Clear(); GvAOP.Rows[0].Cells.Add(new TableCell()); GvAOP.Rows[0].Cells[0].ColumnSpan = columncount; GvAOP.Rows[0].Cells[0].Text = ""; } else { //Search Option-RUS ViewState["dtOrder"] = ds.Tables[0]; //Search Option-RUS GvAOP.DataSource = ds; GvAOP.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 + "%'"; GvAOP.DataSource = dvOrder; GvAOP.DataBind(); }