Has a SelectedValue which is invalid because it does not exist

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?
 
F

Fcorod

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top