protected void CategoriesDropDownList_SelectedIndexChanged(object sender, EventArgs e) { try { int id = Convert.ToInt32(CategoriesDropDownList.SelectedValue); ItemsDropDownList.DataSource = _PurchaseRepository.GetAllItemsByCategories(id); ItemsDropDownList.DataTextField = "Name"; ItemsDropDownList.DataValueField = "Code"; ItemsDropDownList.DataBind(); ItemsDropDownList.Items.Insert(0, new ListItem("Chose Items", "0")); } catch { } }