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