title: ObjectDataSource could not find a non-generic method that takes parameters of type
body: <p>I've got a vexing problem with an ObjectDataSource (bound to a DetailsView) that is not checking the DeleteParameters for a delete method (which I specified both in the markup and the data object as requiring an integer). 
  Here's the markup:</p>
  
  <pre><code>&lt;asp:ObjectDataSource ID="odsFrontPageBannerDetails" runat="server" DataObjectTypeName="FrontPage.Banner" DeleteMethod="DeleteFrontPageBanner" InsertMethod="InsertFrontPageBanner" SelectMethod="GetFrontPageBanner" UpdateMethod="UpdateFrontPageBanner" TypeName="FrontPage.BannersData"&gt;
      &lt;DeleteParameters&gt;
          &lt;asp:Parameter Name="idx" Type="Int32"  /&gt;
      &lt;/DeleteParameters&gt;
      &lt;SelectParameters&gt;
          &lt;asp:ControlParameter ControlID="GridView1" Name="idx" PropertyName="SelectedValue" Type="Int32" /&gt;
      &lt;/SelectParameters&gt;
  &lt;/asp:ObjectDataSource&gt;
  </code></pre>
  
  <p>and the object:</p>
  
  <pre><code>&lt;DataObjectMethod(DataObjectMethodType.Delete, True)&gt; _
  Public Shared Function DeleteFrontPageBanner(ByVal idx As Integer) As Integer
      Dim retval As Integer = 0
      Dim iReturnCode As Integer = 0
      Using conn As New SqlConnection(GetConnStr())
          Using cmd As New SqlCommand
              cmd.CommandType = CommandType.StoredProcedure
              cmd.CommandText = "FrontPage_BannerDelete"
              cmd.Connection = conn
              cmd.Parameters.AddWithValue("@idx", idx)
              Try
                  conn.Open()
                  iReturnCode = cmd.ExecuteNonQuery
                  If iReturnCode &gt;= 0 Then
                      retval = 1
                      LastErrorMsg = String.Empty
                  Else
                      Throw New DataException("Return code is: " &amp; iReturnCode)
                  End If
              Catch ex As Exception
                  LastErrorMsg = ex.Message
                  retval = 0
              End Try
          End Using
      End Using
      Return retval
  End Function
  </code></pre>
  
  <p>and the detailsview markup:</p>
  
  <pre><code>   &lt;asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" CellPadding="4" DataSourceID="odsFrontPageBannerDetails" ForeColor="#333333" GridLines="None" Height="50px" Width="338px"&gt;
          &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
          &lt;CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /&gt;
          &lt;EditRowStyle BackColor="#999999" /&gt;
          &lt;FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" /&gt;
          &lt;Fields&gt;
              &lt;asp:BoundField DataField="idx" HeaderText="idx" ReadOnly="True" SortExpression="idx" /&gt;
              &lt;asp:CheckBoxField DataField="Active" HeaderText="Active" SortExpression="Active" /&gt;
              &lt;asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /&gt;
              &lt;asp:BoundField DataField="BannerText" HeaderText="BannerText" SortExpression="BannerText" /&gt;
              &lt;asp:BoundField DataField="BannerImage" HeaderText="Banner Image" SortExpression="BannerImage" /&gt;
              &lt;asp:BoundField DataField="BannerLink" HeaderText="Go To Page Link" SortExpression="BannerLink" /&gt;
              &lt;asp:BoundField DataField="BackgroundColor" HeaderText="Background Color" SortExpression="BackgroundColor" /&gt;
              &lt;asp:BoundField DataField="BannerHeight" HeaderText="Banner Height" HtmlEncode="False" SortExpression="BannerHeight" /&gt;
              &lt;asp:BoundField DataField="StartDate" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Start Date" HtmlEncode="False" SortExpression="StartDate" /&gt;
              &lt;asp:BoundField DataField="EndDate" DataFormatString="{0:MM/dd/yyyy}" HeaderText="End Date" HtmlEncode="False" SortExpression="EndDate" /&gt;
              &lt;asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" /&gt;
          &lt;/Fields&gt;
          &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
          &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
          &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
          &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
      &lt;/asp:DetailsView&gt;
  </code></pre>
  
  <p>The error indicates that the DeleteParameters are completely ignored! (I followed an example straight from a video tutorial and it worked fine for the author)</p>
  
  <blockquote>
    <p>ObjectDataSource 'odsFrontPageBannerDetails' could not find a
    non-generic method 'DeleteFrontPageBanner' that takes parameters of
    type 'FrontPage.Banner'.</p>
  </blockquote>
  
  <p>Any ideas? I've tried rebuilding the solution and the page with no luck!</p>
  
  <p>After trying every combination of parameters I could think of with no success, I decided to just change the delete method to accept the Frontpage.Banner object and now it deletes without an error - See change below:</p>
  
  <pre><code>&lt;DataObjectMethod(DataObjectMethodType.Delete, True)&gt; _
  Public Shared Function DeleteFrontPageBanner(ByVal o As FrontPage.Banner) As Integer
      Dim retval As Integer = 0
      Dim iReturnCode As Integer = 0
      Using conn As New SqlConnection(GetConnStr())
          Using cmd As New SqlCommand
              cmd.CommandType = CommandType.StoredProcedure
              cmd.CommandText = "FrontPage_BannerDelete"
              cmd.Connection = conn
              cmd.Parameters.AddWithValue("@idx", o.idx)
              Try
                  conn.Open()
                  iReturnCode = cmd.ExecuteNonQuery
                  If iReturnCode &gt;= 0 Then
                      retval = 1
                      LastErrorMsg = String.Empty
                  Else
                      Throw New DataException("Return code is: " &amp; iReturnCode)
                  End If
              Catch ex As Exception
                  LastErrorMsg = ex.Message
                  retval = 0
              End Try
          End Using
      End Using
      Return retval
  End Function
  </code></pre>
  
  <p>Still would love an explanation of why the delete parameters in the markup are completely ignored.</p>