I have a DropDownList in an ASP.NET web form that is populated with items
from a lookup table by binding that DropDownList to a SqlDataSource.
However, the items in the lookup table can change over time. The problem is
that when an item has been removed from the lookup table, and a user wants
to retrieve a record that used the deleted item, the following error occurs:
'ddlAssignedTo' has a SelectedValue which is invalid because it does not
exist in the list of items.
I need to allow the lookup table items to change, while still allowing
retrieval of old records that used the now deleted items. I could add a
field to the lookup table indicating whether an item is active or inactive,
but only the active ones (and the selected one) should appear in the
DropDownList.
So, is there a way to either
a) Allow entries into a DropDownList that are not in the databound table
(like a VB ComboBox), or
b) Add the missing value to the DropDownList items after it is bound to
the table?
Thanks,
Brett
from a lookup table by binding that DropDownList to a SqlDataSource.
However, the items in the lookup table can change over time. The problem is
that when an item has been removed from the lookup table, and a user wants
to retrieve a record that used the deleted item, the following error occurs:
'ddlAssignedTo' has a SelectedValue which is invalid because it does not
exist in the list of items.
I need to allow the lookup table items to change, while still allowing
retrieval of old records that used the now deleted items. I could add a
field to the lookup table indicating whether an item is active or inactive,
but only the active ones (and the selected one) should appear in the
DropDownList.
So, is there a way to either
a) Allow entries into a DropDownList that are not in the databound table
(like a VB ComboBox), or
b) Add the missing value to the DropDownList items after it is bound to
the table?
Thanks,
Brett
Comment