DropDownList AppendDataBoundItems (first item to be blank and no duplicates)

Instead of using AppendDataboundItems="true" (which will cause the problem you are talking about), respond to the DataBound event for the DropDownList and then add your “blank” item to the top of the list.

<asp:DropDownList runat="server" ID="MyList"
  ondatabound="MyListDataBound"></asp:DropDownList>

Then in your code behind:

protected void MyListDataBound(object sender, EventArgs e)
{
    MyList.Items.Insert(0, new ListItem("- Select -", ""));
}

Leave a Comment