Note that there are some explanatory texts on larger screens.

plurals
  1. POObjectDataSource paging and extra parameters
    text
    copied!<p>I'm using an ObjectDataSource to sort/page/filter as below:</p> <pre><code> &lt;asp:ObjectDataSource ID="odsCompaniesIndex" runat="server" EnablePaging="true" SelectMethod="GetCompaniesSubset" StartRowIndexParameterName="startRowIndex" MaximumRowsParameterName="maximumRows" SelectCountMethod="GetCompaniesCount" SortParameterName="sortExpression" TypeName="Company"&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID="ddlStatus" ConvertEmptyStringToNull="true" DbType="Boolean" PropertyName="SelectedValue" Name="status" /&gt; &lt;/SelectParameters&gt; &lt;/asp:ObjectDataSource&gt; </code></pre> <p>The gridview consuming the ObjectDataSource:</p> <pre><code> &lt;asp:GridView ID="gvCompanyIndex" AutoGenerateColumns="true" runat="server" DataSourceID="odsCompaniesIndex" AllowPaging="true" DataKeyNames="company_id" AllowSorting="true"&gt; &lt;/asp:GridView&gt; </code></pre> <p>I want to pass in a number of parameters like the one above into SelectParameters. The method call 'GetCompaniesSubset' executes but on the return I get the following error:</p> <blockquote> <p>ObjectDataSource 'odsCompaniesIndex' could not find a non-generic method 'GetCompaniesCount' that has parameters: status.</p> </blockquote> <p>My SelectMethod is:</p> <pre><code> public DataSet GetCompaniesSubset( int startRowIndex, int maximumRows, string sortExpression, bool status) {...} </code></pre> <p>How do you allow the SelectMethod to utilise StartRowIndexParameterName/MaximumRowsParameterName and any extra parameters?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload