How to insert item as LAST option in a dropdown list
asp.net, c#
Solution
to add to the LAST position, just add to the list as
ddlTest.Items.Add(new ListItem("---New First Item---", "-1"));
as it will append to the last place by default.
Problem
I know to add an item as the first item, I use: ``` ddlTest.Items.Insert(0, new ListItem("---New First Item---", "-1")); ``` I tried `-1` as the index but then I didn't even see the item. How to I add an item as the last item in the list without knowing its index number (because the dropdown is populated from a database)?