W
WJB
I'm using a FormView with a number of DropDownList controls that are bound to
SqlDataSources. Sometimes, the current contents of the bound fields are
invalid (i.e. not in the list of items retrieved from the data source used as
the DataSourceID for the dropdown list). Trapping the OnDataBinding event is
too early since the list items and selected index/text have not been
populated yet. Trapping the OnDataBound event is too late as the exception
has already been thrown. The rules I'm working with make such that I cannot
add the invalid item to the list's data source.
Am I understanding this correctly? Is there a way to try..catch an exception
that seems to occur between two events firing? Or there a better way to
accomplish this short of doing it the hard way and replacing the
SqlDataSources with ObjectDataSources and coding the data access myself?
Thanks
SqlDataSources. Sometimes, the current contents of the bound fields are
invalid (i.e. not in the list of items retrieved from the data source used as
the DataSourceID for the dropdown list). Trapping the OnDataBinding event is
too early since the list items and selected index/text have not been
populated yet. Trapping the OnDataBound event is too late as the exception
has already been thrown. The rules I'm working with make such that I cannot
add the invalid item to the list's data source.
Am I understanding this correctly? Is there a way to try..catch an exception
that seems to occur between two events firing? Or there a better way to
accomplish this short of doing it the hard way and replacing the
SqlDataSources with ObjectDataSources and coding the data access myself?
Thanks