has a SelectedValue which is invalid because it does not exist in the list of item
The SelectedValue before the databind is set to "" (i.e. blank string)
The error occurs because the data being bound does not include a value of "" (blank string).
To fix it:
- Set AppendDataBoundItems=true for control
- Clear the list prior to databind;
.Items.Clear(); - Add a blank item:
.Items.Add(new ListItem("", "")); - Call
.DataBind();