// add new product in grid view protected void Button3_Click(object sender, EventArgs e) { DataTable dt1 = Select_Logic.search_product("select_tbl_product_give_unique_no_sp", txt_unique_id2.Text); grv_view_prod.DataSource = dt1; grv_view_prod.DataBind(); }
//search by product name or product id protected void Button6_Click(object sender, EventArgs e) { if (txt_unique_id.Text == "" && txt_product_name.Text == "") { error_msg.Text = "Enter Product Id OR Product Name"; error_msg.ForeColor = System.Drawing.Color.Red; return; } else if (txt_unique_id.Text != "" && txt_product_name.Text != "") { error_msg.Text = "Do Not Enter Product Id OR Product Name"; error_msg.ForeColor = System.Drawing.Color.Red; return; } else if (txt_unique_id.Text != "") { DataTable dt = Select_Logic.search_product("select_tbl_product_give_unique_no_sp", txt_unique_id.Text); if (dt.Rows.Count == 0) { error_msg.Text = "product not found"; grv_product.DataSource = null; grv_product.DataBind(); } else { grv_product.DataSource = dt; grv_product.DataBind(); } } else if (txt_product_name.Text != "") { DataTable dt = Select_Logic.search_product2("select_tbl_product_give_product_name", txt_product_name.Text); //check wherther data is available or not if (dt.Rows.Count == 0) { error_msg.Text = "product does not found"; grv_product.DataSource = null; grv_product.DataBind(); } else { grv_product.DataSource = dt; grv_product.DataBind(); } } }