public void LoadDDL() { Brands_BAL Bnds = new Brands_BAL(); Categories_BAL cate = new Categories_BAL(); DataSet ds = Bnds.GetAllBrand(); DataSet dsCate = cate.GetAllCategories(); if (ds.Tables[0].Rows.Count > 0) { //Dispose the Dataset first. ds.Dispose(); DDLBrand.Items.Clear(); DDLBrand.DataSource = ds; DDLBrand.DataTextField = "BrandName"; DDLBrand.DataValueField = "BrandID"; DDLBrand.DataBind(); DDLBrand.Items.Insert(0, new ListItem("-- Select any brand --", "0")); } if (dsCate.Tables[0].Rows.Count > 0) { //Dispose the Dataset first. ds.Dispose(); DDLCategory.Items.Clear(); DDLCategory.DataSource = dsCate; DDLCategory.DataTextField = "CategoryName"; DDLCategory.DataValueField = "CategoryID"; DDLCategory.DataBind(); DDLCategory.Items.Insert(0, new ListItem("-- Select any category --", "0")); } }