SelectedValue which is invalid because it does not exist in the list of items

前端 未结 9 1726
孤独总比滥情好
孤独总比滥情好 2021-02-03 21:16

I encounter this problem repeatedly, and haven\'t a clue what is causing it. I get an exception in the DataBind: SelectedValue which is invalid because it does not exist i

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 21:27

    I kept getting this error.
    Weird thing is that before I set the datasource and rebind after deleting an item the selected index = -1.

    If I explicitly set the selectedIndex = -1; then it works and doesn't throw an error.

    So even though it was already -1 setting it to -1 stops it from erroring.

    Weird eh?

提交回复
热议问题