But if you want to loop anyway, here is the loop :DropDownList1.Items.RemoveAt(0);
foreach (ListItem item in DropDownList1.Items) { // your condition}
Or if you know the index of the item to remove, use RemoveAt method :
ListItem itemToRemove = DropDownList1.Items.FindByValue("value"); if (itemToRemove != null) { DropDownList1.Items.Remove(itemToRemove); }
No comments:
Post a Comment