I have an ASP.Net form where I use a DropDownList control to display data retrieved from a table. However setting the SelectedValue of the DropDownList to a value not existing in the dropdown list does not trigger an exception.
Try
dropDownList.SelectedValue = value
Catch ex as Exception
Throw
End Try
In the code above, if I assign a value that does not belong to the list's item, it does not throw an Exception. It just selects the first item in the list when the HTML is rendered.
Any ideas why?
By the way, I have a blank (String.Empty) item as the first item in the list. I also used DataBind() to bind the listItem to a DataTable. Does that make any difference?