Some workaround for ObjectDataSource: could not find a non-generic method ‘…’

I tried to use generated by VS 2005 typed dataset/adaptors with  ObjectDataSource and got am error:


Exception Details

: System.InvalidOperationException: ObjectDataSource ‘odsCascadeRulesValues’ could not find a nongeneric method ‘Update’ that has parameters: ….


I found the thread that suggested some workarounds, but the simple one “Change this  OldValuesParameterFormatString=”original_{0}” to  OldValuesParameterFormatString=”{0}” didn’t work for me.

I’ve found that the problem only happened if your Update/Delete methods were generated using “Optimistic Concurrency”. In this case you need to create own Update method with parameters expected/specified in ObjectDataSource/UpdateParameters element.


Alternatively, if you are happy not to check for concurrency, you can re-generate your adaptor methods:
1.Select Adaptor
2.Click Configure
3.Click “Advanced Options…” 
4.Untick  “Use Optimistic Concurrency”.
5.Click “Finish” to generate Updates


Now you should go to your ASPX/ASCX and configure ObjectDataSource . Ensure that correct Update and Delete methods are selected.


There is another thread “Dataset + ObjectDatasource + GridView + ASP.NET 2” that discuss different options for workaround.
Update: I’ve posted related “Editable GridView with ObjectDatasource and Update method parameters.” and “Why we are getting ObjectDataSource: could not find a non-generic method ‘Update'” .


 

Advertisements