I'm using an ObjectDataSource to perform CRUD operations. For some reason I am getting an "ObjectDataSource 'ObjectDataSource1' has no values to insert. Check that the 'values' dictionary contains values."
Any suggestions?
I understand that this control inherits from the ObjectDataSource Control. According to the documentation http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.insertmethod.aspx
If the DataObjectTypeName property is set, the method is resolved in a different way. The ObjectDataSource looks for a method with the name that is specified in the InsertMethod property that takes one parameter of the type that is specified in the DataObjectTypeName property.
That's how my ObjectDataSource Control is setup.
<asp: ObjectDataSource ID="ObjectDataSource1" runat="server"
DataObjectTypeName="MyApplication.Entities.Domain.MyObject" ConflictDetection="CompareAllValues"
OldValuesParameterFormatString="original{0}" SelectMethod="GetUserDisplays"
InsertMethod="CreateMyObject" UpdateMethod="UpdateMyObject" DeleteMethod="DeleteDisplay">
</asp:ObjectDataSource>
I set a breakpoint on the InsertMethod, but the application does not even hit it when I try to save my form. I suspect the DataObjectType is not being instantiated properly for some reason.
I'm trying to perform the Insert operation in the EditForm of an ASPxGridview control and the DataObjectType is an EF POCO which has some additional properties (marked virtual) in it to load related entities from the ObjectContext. I think this may be the problem but don't know how to fix it (have looked everywhere!!!).
Any help would be greatly appreciated!