Has a SelectedValue which is invalid because it does not exist

  • Thread starter Thread starter Mahesh Nimbalkar
  • Start date Start date
M

Mahesh Nimbalkar

On my page, I have ObjectDataSource and ListView. In Oninit method, I am
setting selected value of Listbox.

In above scenario, it throws error if I set SelectedValue property of
ListBox and if that item does not exist in ListBox collection.

"has a SelectedValue which is invalid because it does not exist "

I want to suppress this error if that item to be have selected does not
exist in collection.

I am thinking to hook DataBinding or Selected event of ObjectDataSource and
suppress error in that event. Could you please give example of those events
in this context?
 
Mahesh Nimbalkar said:
On my page, I have ObjectDataSource and ListView. In Oninit method, I am
setting selected value of Listbox.

In above scenario, it throws error if I set SelectedValue property of
ListBox and if that item does not exist in ListBox collection.

"has a SelectedValue which is invalid because it does not exist "

I want to suppress this error if that item to be have selected does not
exist in collection.

I am thinking to hook DataBinding or Selected event of ObjectDataSource and
suppress error in that event. Could you please give example of those events
in this context?
 
Back
Top