protected void cmdProductCode_Click(object sender, System.Web.UI.ImageClickEventArgs e) { DataClass clsDataClass = new DataClass(); Data.ProductColumns clsProductColumns = new Data.ProductColumns(); clsProductColumns.ProductID = true; clsProductColumns.ProductCode = true; string strSearchKey = txtProductCode.Text.Trim(); Data.ProductDetails clsSearchKeys = new Data.ProductDetails(); clsSearchKeys.BarCode = strSearchKey; clsSearchKeys.BarCode2 = strSearchKey; clsSearchKeys.BarCode3 = strSearchKey; clsSearchKeys.ProductCode = strSearchKey; Data.Products clsProduct = new Data.Products(); cboProductCode.DataTextField = "ProductCode"; cboProductCode.DataValueField = "ProductID"; cboProductCode.DataSource = clsProduct.ListAsDataTable(clsSearchKeys: clsSearchKeys, limit: 100).DefaultView; cboProductCode.DataBind(); clsProduct.CommitAndDispose(); if (cboProductCode.Items.Count == 0) { cboProductCode.Items.Add(new ListItem("No product", "0")); } cboProductCode.SelectedIndex = 0; cboProductCode_SelectedIndexChanged(null, null); }
protected void cmdProductCode_Click(object sender, System.Web.UI.ImageClickEventArgs e) { DataClass clsDataClass = new DataClass(); Data.ProductColumns clsProductColumns = new Data.ProductColumns(); clsProductColumns.ProductID = true; clsProductColumns.ProductCode = true; string strSearchKey = txtProductCode.Text.Trim(); Data.ProductDetails clsSearchKeys = new Data.ProductDetails(); clsSearchKeys.BarCode = strSearchKey; clsSearchKeys.BarCode2 = strSearchKey; clsSearchKeys.BarCode3 = strSearchKey; clsSearchKeys.ProductCode = strSearchKey; Data.Products clsProduct = new Data.Products(); cboProductCode.DataTextField = "ProductCode"; cboProductCode.DataValueField = "ProductID"; cboProductCode.DataSource = clsProduct.ListAsDataTable(clsSearchKeys: clsSearchKeys, limit: 100).DefaultView; cboProductCode.DataBind(); clsProduct.CommitAndDispose(); if (cboProductCode.Items.Count == 0) cboProductCode.Items.Add(new ListItem("No product", "0")); cboProductCode.SelectedIndex = 0; cboProductCode_SelectedIndexChanged(null, null); }