protected void companyDropDownList_SelectedIndexChanged(object sender, EventArgs e) { itemNameDropDownList.Items.Clear(); string companyName = companyDropDownList.SelectedIndex.ToString(); List <Items> aItem = aStockInManager.GetItemNames(companyName); if (aItem != null) { itemNameDropDownList.DataSource = aItem; itemNameDropDownList.AppendDataBoundItems = true; itemNameDropDownList.Items.Add(new ListItem("--Select--")); itemNameDropDownList.DataTextField = "ItemName"; itemNameDropDownList.DataValueField = "ItemNo"; itemNameDropDownList.DataBind(); } else { Literal1.Text = "Item not Found"; } }