ObjectDataSource 'GenericObjectDataSource1' could not find a non-generic method 'Delete' that has parameters: entity, submitChanges, entity1, submitChanges1.

Jun 19, 2010 at 12:50 PM
Edited Jun 19, 2010 at 1:08 PM

Hi ,

I use a gridview and GenericObjectDataSource . I did this instruction :

Put a GenericObjectDataSource on my form and  configured my DataSource via choosing a MyDataLayer.MyObjectStaticRepository and all defaut value , then put a GridView and Bind it to GenericObjectDataSource . I chcked "EnableDeleting"  on my GridView and set my DatakeyName and nothing more .

  But for deleting all the time i ge this error :

ObjectDataSource 'GenericObjectDataSource1' could not find a non-generic method 'Delete' that has parameters: entity, submitChanges, entity1, submitChanges1.

I looked on you Example source Code and find out you specified your GenericDatasource Like this :

        <DataLayer:GenericObjectDataSource ID="ProductDataSource" runat="server" EnablePaging="true"
            SortParameterName="sortExpression" OnUpdated="ProductDataSource_Updated" OnInserted="ProductDataSource_Updated"
            DataObjectTypeName="DataLayer.Product" TypeName="DataLayer.ProductStaticRepository" />

 

While i have like this :

                    <cc1:GenericObjectDataSource ID="GenericObjectDataSource1" runat="server" DeleteMethod="Delete"
                        OldValuesParameterFormatString="original_{0}" SelectCountMethod="Count" SelectMethod="SelectAll"
                        TypeName="EMDataLayer.CodingStaticRepository" UpdateMethod="Update">
                        <DeleteParameters>
                            <asp:Parameter Name="entity" Type="Object"></asp:Parameter>
                            <asp:Parameter DefaultValue="true" Name="submitChanges" Type="Boolean"></asp:Parameter>
                        </DeleteParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="entity" Type="Object"></asp:Parameter>
                            <asp:Parameter DefaultValue="true" Name="submitChanges" Type="Boolean"></asp:Parameter>
                        </UpdateParameters>
                    </cc1:GenericObjectDataSource>

I tried a lot different ways , But unable to delete records .

I appreciate any help .

 

Thanks in advance