protected void SearchProductsPartial_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(PartialProductNameV2.Text)) { ShowMessage("Enter a Product Name or Parial Name", "alert alert-info"); ProductGridViewV2.DataSource = null; ProductGridViewV2.DataBind(); } else { try { ProductController sysmgr = new ProductController(); List <Product> info = sysmgr.FindByPartialName(PartialProductNameV2.Text); if (info.Count == 0) { ShowMessage("Record was not found", "alert alert-warning"); } else { info.Sort((x, y) => x.ProductName.CompareTo(y.ProductName)); ProductGridViewV2.DataSource = info; ProductGridViewV2.DataBind(); } } catch (Exception ex) { ShowMessage(GetInnerException(ex).ToString(), "alert alert-danger"); } } }
protected void SearchProductsPartial_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(PartialProductNameV2.Text)) { errormsgs.Add("Please enter a partial product name for the search"); LoadMessageDisplay(errormsgs, "alert alert-info"); ProductGridViewV2.DataSource = null; ProductGridViewV2.DataBind(); } else { try { ProductController sysmgr = new ProductController(); List <Product> info = sysmgr.Products_GetByPartialProductName(PartialProductNameV2.Text); if (info.Count == 0) { errormsgs.Add("No data found for the partial product name search"); LoadMessageDisplay(errormsgs, "alert alert-info"); } else { info.Sort((x, y) => x.ProductName.CompareTo(y.ProductName)); //load the multiple record control //GridView ProductGridViewV2.DataSource = info; ProductGridViewV2.DataBind(); } } catch (Exception ex) { errormsgs.Add(GetInnerException(ex).ToString()); LoadMessageDisplay(errormsgs, "alert alert-danger"); } } }