private void GetAllCompanyBrandIds() { try { clsBrands objBrand = new clsBrands(); DataSet dsCBData = objBrand.GetAllCompanyBrandData(); if (dsCBData.Tables[0].Rows.Count != 0) { ddlCBIds.DataSource = dsCBData.Tables[0]; ddlCBIds.DataTextField = "CompanyBrandName"; ddlCBIds.DataValueField = "CompanyBrandId"; ddlCBIds.DataBind(); ddlCBIds.Items.Insert(0, "--Select One--"); } else { ddlProducts.Items.Insert(0, "--Select One--"); ddlProducts.Items.Insert(1, "No Data"); } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
protected void btnShowAll_Click(object sender, EventArgs e) { try { lblMsg.Text = ""; if (btnShowAll.Text == "Show All") { objBrand = new clsBrands(); DataSet ds = objBrand.GetAllCompanyBrandData(); if (ds.Tables[0].Rows.Count != 0) { grdCompanyBrand.DataSource = ds.Tables[0]; grdCompanyBrand.DataBind(); } else { grdCompanyBrand.EmptyDataText = "Record not found."; grdCompanyBrand.DataBind(); } btnShowAll.Text = "Close Grid"; divData.Visible = true; } else if (btnShowAll.Text == "Close Grid") { btnShowAll.Text = "Show All"; divData.Visible = false; } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
private void GetCompanyBrandId() { try { ddlCompanyBrandId.Items.Clear(); clsBrands objBrand = new clsBrands(); DataSet ds = objBrand.GetAllCompanyBrandData(); if (ds.Tables[0].Rows.Count != 0) { ddlCompanyBrandId.DataSource = ds.Tables[0]; ddlCompanyBrandId.DataTextField = "CompanyBrandName"; ddlCompanyBrandId.DataValueField = "CompanyBrandId"; ddlCompanyBrandId.DataBind(); } ddlCompanyBrandId.Items.Insert(0, "--Select One--"); } catch (Exception ex) { lblMsg.Text = ex.Message; } }