I have a drop-down as follows
<asp:Label runat="server" Text="Available Items"></asp:Label>
<asp:DropDownList runat="server" ID="ddItems" />
Here is how data is populated in this dropdown.
protected void Page_Load(object sender, EventArgs e)
{
this.ddItems.Items.Add(new ListItem("first item", "1"));
this.ddItems.Items.Add(new ListItem("second item", "2"));
this.ddItems.Items.Add(new ListItem("third item", "3"));
this.ddItems.SelectedIndex = -1;
}
Since SelectedIndex is set to -1, I expect no items to be selected but first item is showing up in the drop down.
What am I doing wrong?