Dropdownlist data binding inside detailsview in asp.net

weby

New Member
I have detailsview that will be used to edit customer records. Inside this detailsview, I have a dropdownlist that shows list of countries.I have a table called CountryList that will populate list of countries to the above dropdownlist.User can edit and save data without any issue.But, assume that customer record has the country selected as "Australia" and if I delete Australia from the CountryList and try to edit the customer inside the details view, I am getting below error.\[code\]SelectedValue which is invalid because it does not exist in the list of items\[/code\]I know the reason because the \[code\]SelectedValue='http://stackoverflow.com/questions/14576817/<%# Bind("Country") %>' \[/code\]and it can't find it in the list.So my question is, how to overcome this issue ? After searching the web, I found that I can override the Databind but I am not sure how to do this. Have no idea how to override and can someone please give me sample code ? Also is there any other solution for this such as validate it before set ? Thank you.
 
Back
Top