The exception says my dropdown “has a SelectedValue which is invalid because it does not exist in the list of items”
This is after selecting the item from a previous page. The dropdown is bound to a dataset filled with data from a stored procedure. The value from the database has an ampersand in it which is encoded in the html source. When I remove the ampersand from the data it doesn’t throw the exception anymore. I think its because it can’t match the posted value to the encoded html but I’m not sure how the binding works.
The issue was in saving the dropdown value directly to the object before redirecting to the next page. I was saving the Encoded value and needed to save the Decoded value. I called Server.HtmlDecode when saving it and it no longer throws the exception.