I have written a C# Web Site within visual studio 2008. I am using an asp.net 3.5 listview control. Within the edit template I have a drop down list bound to an object data source control which has a select query restricting items to those only created after the current date. Due to this when users try to edit an item that was created before the current date the following error is thrown:
Sys.WebForms.PageRequestManagerServerErrorException: 'DropDownControlID' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value. Code:0
How can I catch this error and display a message box to the user stating that "edits cannot be made as this item has expired"?