Most programmers working with asp.net ObjectDataSource are bound to be irritated by this error: ObjectDataSource 'myObjDataDource' could not find a non-generic method 'myMethod' that has parameters: my_ID
I guess this is due to the nature the asp.net ObjectDataSource does so many things automatically. As I have described in this article that well describes how to do master detail data display using asp.net GridView and DetailsView controls by use of asp.net ObjectDataSource, we can use business objects to perform various database operations using asp.net ObjectDataSource control. All we have to do is define the correspomding methods in the business logic layer (BLL), which can be done easily using either three tier or two tier asp.net web application architecture, either involving only . business logic layer (BLL) or using both business logic layer (BLL) and Data Access Layer (DLL). So there are some points that will help detect why the "objectdatasource could not find the non-generic method" error occurs.
- Make sure all methods [SelectMethod, UpdateMethod, DeleteMethod, SelectCountMethod, InsertMethod] used by the ObjectDataSource are typed correctly.
- Check to verify the Type actually contains the above methods (mostly programmers may have misspelled them).
- Third but important point: do these methods contain exact parameters as pointed in the error, both in number and order. Remember that the order of parameters mean a lot for ObjectDataSource methods. (And perhaps you too are stumbled here! At least I had this problem.)
Follow the above steps and you are nearest to the solution. At least my experience tells these careful steps will guide you understand the core of asp.net objectdatasource control's behavious. Please share if you have similar or advanced experiences regarding this "objectdatasource could not find the non-generic method" error.